1 /* src/vm/method.h - method functions header
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Reinhard Grafl
29 Changes: Christian Thalinger
31 $Id: method.h 2181 2005-04-01 16:53:33Z edwin $
38 /* forward typedefs ***********************************************************/
40 typedef struct methodinfo methodinfo;
41 typedef struct exceptiontable exceptiontable;
42 typedef struct lineinfo lineinfo;
45 #include "vm/global.h"
47 #include "vm/references.h"
48 #include "vm/descriptor.h"
49 #include "vm/jit/jit.h"
50 #include "vm/jit/inline/parseXTA.h"
53 /* methodinfo *****************************************************************/
55 struct methodinfo { /* method structure */
56 java_objectheader header; /* we need this in jit's monitorenter */
57 s4 flags; /* ACC flags */
58 utf *name; /* name of method */
59 utf *descriptor; /* JavaVM descriptor string of method */
60 methoddesc *parseddesc; /* parsed descriptor */
62 s4 returntype; /* only temporary valid, return type */
63 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
65 s4 paramcount; /* only temporary valid, parameter count */
66 u1 *paramtypes; /* only temporary valid, parameter types */
67 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
69 bool isleafmethod; /* does method call subroutines */
71 classinfo *class; /* class, the method belongs to */
72 s4 vftblindex; /* index of method in virtual function */
73 /* table (if it is a virtual method) */
74 s4 maxstack; /* maximum stack depth of method */
75 s4 maxlocals; /* maximum number of local variables */
76 s4 jcodelength; /* length of JavaVM code */
77 u1 *jcode; /* pointer to JavaVM code */
79 s4 basicblockcount; /* number of basic blocks */
80 basicblock *basicblocks; /* points to basic block array */
81 s4 *basicblockindex; /* a table which contains for every byte */
82 /* of JavaVM code a basic block index if */
83 /* at this byte is the start of a basic */
86 s4 instructioncount; /* number of JavaVM instructions */
87 instruction *instructions; /* points to intermediate code instr. */
89 s4 stackcount; /* number of stack elements */
90 stackelement *stack; /* points to intermediate code instr. */
92 s4 exceptiontablelength;/* exceptiontable length */
93 exceptiontable *exceptiontable; /* the exceptiontable */
95 u2 thrownexceptionscount;/* number of exceptions attribute */
96 classinfo **thrownexceptions; /* checked exceptions a method may throw */
98 u2 linenumbercount; /* number of linenumber attributes */
99 lineinfo *linenumbers; /* array of lineinfo items */
101 int c_debug_nr; /* a counter to number all BB with an */
104 u1 *stubroutine; /* stub for compiling or calling natives */
105 s4 mcodelength; /* legth of generated machine code */
106 functionptr mcode; /* pointer to machine code */
107 functionptr entrypoint; /* entry point in machine code */
112 bool methodXTAparsed; /* true if xta parsed */
113 s4 methodUsed; /* marked (might be used later) /not used /used */
114 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
115 /* should # method def'd and used be kept after static parse (will it be used?) */
118 s4 nativelyoverloaded; /* used in header.c and only valid there */
119 /* helper for lsra */
124 /* exceptiontable *************************************************************/
126 struct exceptiontable { /* exceptiontable entry in a method */
127 s4 startpc; /* start pc of guarded area (inclusive) */
130 s4 endpc; /* end pc of guarded area (exklusive) */
133 s4 handlerpc; /* pc of exception handler */
136 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
137 exceptiontable *next; /* used to build a list of exception when */
138 /* loops are copied */
139 exceptiontable *down; /* instead of the old array, a list is used */
143 /* lineinfo *******************************************************************/
151 /* function prototypes ********************************************************/
153 void method_free(methodinfo *m);
154 bool method_canoverwrite(methodinfo *m, methodinfo *old);
156 void method_display(methodinfo *m);
157 void method_display_w_class(methodinfo *m);
159 #endif /* _METHOD_H */
163 * These are local overrides for various environment variables in Emacs.
164 * Please do not remove this and leave it at the end of the file, where
165 * Emacs will automagically detect them.
166 * ---------------------------------------------------------------------
169 * indent-tabs-mode: t