* src/vm/jit/i386/emit.c (emit_verbosecall_enter): Check for
[cacao.git] / src / vm / jit / code.h
1 /* src/vm/jit/code.h - codeinfo struct for representing compiled code
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Edwin Steiner
28             Christian Thalinger
29
30    $Id$
31
32 */
33
34
35 #ifndef _CODE_H
36 #define _CODE_H
37
38 /* forward typedefs ***********************************************************/
39
40 typedef struct codeinfo codeinfo;
41
42 #include "config.h"
43 #include "vm/types.h"
44
45 #include "vm/global.h"
46 #include "vm/method.h"
47 #include "vm/jit/replace.h"
48
49
50 /* codeinfo *******************************************************************
51
52    A codeinfo represents a particular realization of a method in
53    machine code.
54
55    ATTENTION: The methodinfo entry in the code-structure MUST have the
56    offset 0, otherwise we have a problem in our compiler stub. This is
57    checked with an assert in code_init().
58
59 *******************************************************************************/
60
61 struct codeinfo {
62         methodinfo   *m;                    /* method this is a realization of    */
63         codeinfo     *prev;                 /* previous codeinfo of this method   */
64
65         bool          invalid;
66
67         u1            optlevel;             /* optimization level of this code    */
68         s4            basicblockcount;      /* number of basic blocks             */
69
70         /* machine code */
71         u1           *mcode;                /* pointer to machine code            */
72         u1           *entrypoint;           /* machine code entry point           */
73         s4            mcodelength;          /* length of generated machine code   */
74
75         /* replacement */                                   
76         rplpoint     *rplpoints;            /* replacement points                 */
77         rplalloc     *regalloc;             /* register allocation info           */
78         s4            rplpointcount;        /* number of replacement points       */
79         s4            globalcount;          /* number of global allocations       */
80         s4            regalloccount;        /* number of total allocations        */
81         s4            memuse;               /* number of arg + local slots        */
82         s4            stackframesize;       /* size of the stackframe in slots    */
83         u1            savedintcount;        /* number of callee saved int regs    */
84         u1            savedfltcount;        /* number of callee saved flt regs    */
85
86         u4            frequency;            /* number of method invocations       */
87         u4           *bbfrequency;                  
88         s8            cycles;               /* number of cpu cycles               */
89 };
90
91
92 /* function prototypes ********************************************************/
93
94 bool code_init(void);
95
96 codeinfo *code_codeinfo_new(methodinfo *m);
97 void code_codeinfo_free(codeinfo *code);
98
99 int code_get_sync_slot_count(codeinfo *code);
100 int code_get_stack_frame_size(codeinfo *code);
101
102 void code_free_code_of_method(methodinfo *m);
103
104 #endif /* _CODE_H */
105
106
107 /*
108  * These are local overrides for various environment variables in Emacs.
109  * Please do not remove this and leave it at the end of the file, where
110  * Emacs will automagically detect them.
111  * ---------------------------------------------------------------------
112  * Local variables:
113  * mode: c
114  * indent-tabs-mode: t
115  * c-basic-offset: 4
116  * tab-width: 4
117  * End:
118  * vim:noexpandtab:sw=4:ts=4:
119  */