1 /* src/vm/method.h - method functions header
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
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., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Reinhard Grafl
31 $Id: method.h 6216 2006-12-18 18:21:37Z twisti $
38 /* forward typedefs ***********************************************************/
40 typedef struct methodinfo methodinfo;
41 typedef struct raw_exception_entry raw_exception_entry;
42 typedef struct lineinfo lineinfo;
43 typedef struct method_assumption method_assumption;
44 typedef struct method_worklist method_worklist;
49 #include "vm/descriptor.h"
50 #include "vm/global.h"
51 #include "vm/linker.h"
52 #include "vm/references.h"
54 #if defined(ENABLE_JAVASE)
55 # include "vm/stackmap.h"
59 #include "vm/jit/code.h"
60 #include "vm/jit/jit.h"
63 /* methodinfo *****************************************************************/
65 struct methodinfo { /* method structure */
66 java_objectheader header; /* we need this in jit's monitorenter */
67 s4 flags; /* ACC flags */
68 utf *name; /* name of method */
69 utf *descriptor; /* JavaVM descriptor string of method */
70 #if defined(ENABLE_JAVASE)
71 utf *signature; /* Signature attribute */
72 stack_map_t *stack_map; /* StackMapTable attribute */
75 methoddesc *parseddesc; /* parsed descriptor */
77 classinfo *class; /* class, the method belongs to */
78 s4 vftblindex; /* index of method in virtual function */
79 /* table (if it is a virtual method) */
80 s4 maxstack; /* maximum stack depth of method */
81 s4 maxlocals; /* maximum number of local variables */
82 s4 jcodelength; /* length of JavaVM code */
83 u1 *jcode; /* pointer to JavaVM code */
85 s4 rawexceptiontablelength; /* exceptiontable length */
86 raw_exception_entry *rawexceptiontable; /* the exceptiontable */
88 u2 thrownexceptionscount; /* number of exceptions attribute */
89 classref_or_classinfo *thrownexceptions; /* except. a method may throw */
91 u2 linenumbercount; /* number of linenumber attributes */
92 lineinfo *linenumbers; /* array of lineinfo items */
94 u1 *stubroutine; /* stub for compiling or calling natives */
95 codeinfo *code; /* current code of this method */
97 #if defined(ENABLE_LSRA)
98 s4 maxlifetimes; /* helper for lsra */
101 methodinfo *overwrites; /* method that is directly overwritten */
102 method_assumption *assumptions; /* list of assumptions about this method */
106 /* method_assumption ***********************************************************
108 This struct is used for registering assumptions about methods.
110 *******************************************************************************/
112 struct method_assumption {
113 method_assumption *next;
118 /* method_worklist *************************************************************
120 List node used for method worklists.
122 *******************************************************************************/
124 struct method_worklist {
125 method_worklist *next;
130 /* raw_exception_entry ********************************************************/
132 /* exception table entry read by the loader */
134 struct raw_exception_entry { /* exceptiontable entry in a method */
135 classref_or_classinfo catchtype; /* catchtype of exc. (0 == catchall) */
136 u2 startpc; /* start pc of guarded area (inclusive) */
137 u2 endpc; /* end pc of guarded area (exklusive) */
138 u2 handlerpc; /* pc of exception handler */
142 /* lineinfo *******************************************************************/
150 /* function prototypes ********************************************************/
152 void method_free(methodinfo *m);
153 bool method_canoverwrite(methodinfo *m, methodinfo *old);
155 methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m);
157 void method_add_assumption_monomorphic(methodinfo *m, methodinfo *caller);
158 void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl);
161 void method_printflags(methodinfo *m);
162 void method_print(methodinfo *m);
163 void method_println(methodinfo *m);
164 void method_methodref_print(constant_FMIref *mr);
165 void method_methodref_println(constant_FMIref *mr);
168 #endif /* _METHOD_H */
172 * These are local overrides for various environment variables in Emacs.
173 * Please do not remove this and leave it at the end of the file, where
174 * Emacs will automagically detect them.
175 * ---------------------------------------------------------------------
178 * indent-tabs-mode: t
182 * vim:noexpandtab:sw=4:ts=4: