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 3743 2005-11-22 23:41:34Z twisti $
38 /* forward typedefs ***********************************************************/
40 typedef struct methodinfo methodinfo;
41 typedef struct exceptiontable exceptiontable;
42 typedef struct lineinfo lineinfo;
47 #include "vm/global.h"
49 #include "vm/references.h"
50 #include "vm/descriptor.h"
51 #include "vm/jit/jit.h"
52 #include "vm/jit/inline/parseXTA.h"
55 /* methodinfo *****************************************************************/
57 struct methodinfo { /* method structure */
58 java_objectheader header; /* we need this in jit's monitorenter */
59 s4 flags; /* ACC flags */
60 utf *name; /* name of method */
61 utf *descriptor; /* JavaVM descriptor string of method */
62 methoddesc *parseddesc; /* parsed descriptor */
64 s4 returntype; /* only temporary valid, return type */
65 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
67 s4 paramcount; /* only temporary valid, parameter count */
68 u1 *paramtypes; /* only temporary valid, parameter types */
69 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
71 bool isleafmethod; /* does method call subroutines */
73 classinfo *class; /* class, the method belongs to */
74 s4 vftblindex; /* index of method in virtual function */
75 /* table (if it is a virtual method) */
76 s4 maxstack; /* maximum stack depth of method */
77 s4 maxlocals; /* maximum number of local variables */
78 s4 jcodelength; /* length of JavaVM code */
79 u1 *jcode; /* pointer to JavaVM code */
81 s4 basicblockcount; /* number of basic blocks */
82 basicblock *basicblocks; /* points to basic block array */
83 s4 *basicblockindex; /* a table which contains for every byte */
84 /* of JavaVM code a basic block index if */
85 /* at this byte is the start of a basic */
88 s4 instructioncount; /* number of JavaVM instructions */
89 instruction *instructions; /* points to intermediate code instr. */
91 s4 stackcount; /* number of stack elements */
92 stackelement *stack; /* points to intermediate code instr. */
94 s4 exceptiontablelength;/* exceptiontable length */
95 exceptiontable *exceptiontable; /* the exceptiontable */
97 u2 thrownexceptionscount;/* number of exceptions attribute */
98 classref_or_classinfo *thrownexceptions; /* except. a method may throw */
100 u2 linenumbercount; /* number of linenumber attributes */
101 lineinfo *linenumbers; /* array of lineinfo items */
103 int c_debug_nr; /* a counter to number all BB with an */
106 u1 *stubroutine; /* stub for compiling or calling natives */
107 s4 mcodelength; /* legth of generated machine code */
108 u1 *mcode; /* pointer to machine code */
109 u1 *entrypoint; /* entry point in machine code */
114 bool methodXTAparsed; /* true if xta parsed */
115 s4 methodUsed; /* marked (might be used later) /not used /used */
116 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
117 /* should # method def'd and used be kept after static parse (will it be used?) */
120 s4 nativelyoverloaded; /* used in header.c and only valid there */
121 /* helper for lsra */
128 /* exceptiontable *************************************************************/
130 struct exceptiontable { /* exceptiontable entry in a method */
131 s4 startpc; /* start pc of guarded area (inclusive) */
134 s4 endpc; /* end pc of guarded area (exklusive) */
137 s4 handlerpc; /* pc of exception handler */
140 classref_or_classinfo catchtype; /* catchtype of exc. (NULL == catchall) */
141 exceptiontable *next; /* used to build a list of exception when */
142 /* loops are copied */
143 exceptiontable *down; /* instead of the old array, a list is used */
147 /* lineinfo *******************************************************************/
155 /* function prototypes ********************************************************/
157 void method_free(methodinfo *m);
158 bool method_canoverwrite(methodinfo *m, methodinfo *old);
160 void method_display(methodinfo *m);
161 void method_display_w_class(methodinfo *m);
163 void method_descriptor2types(methodinfo *m);
165 #endif /* _METHOD_H */
169 * These are local overrides for various environment variables in Emacs.
170 * Please do not remove this and leave it at the end of the file, where
171 * Emacs will automagically detect them.
172 * ---------------------------------------------------------------------
175 * indent-tabs-mode: t