* src/vm/jit/verify/typecheck.c (verify_fieldaccess): New function.
[cacao.git] / src / vm / method.h
1 /* src/vm/method.h - method functions header
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: Reinhard Grafl
28
29    Changes: Christian Thalinger
30             Edwin Steiner
31
32    $Id: method.h 5657 2006-10-03 21:19:05Z edwin $
33 */
34
35
36 #ifndef _METHOD_H
37 #define _METHOD_H
38
39 /* forward typedefs ***********************************************************/
40
41 typedef struct exceptiontable exceptiontable;
42 typedef struct lineinfo lineinfo; 
43
44 #include "config.h"
45 #include "vm/types.h"
46
47 #include "vm/descriptor.h"
48 #include "vm/global.h"
49 #include "vm/linker.h"
50 #include "vm/references.h"
51 #include "vm/utf8.h"
52 #include "vm/jit/code.h"
53 #include "vm/jit/jit.h"
54
55
56 /* methodinfo *****************************************************************/
57
58 struct methodinfo {                 /* method structure                       */
59         java_objectheader header;       /* we need this in jit's monitorenter     */
60         s4            flags;            /* ACC flags                              */
61         utf          *name;             /* name of method                         */
62         utf          *descriptor;       /* JavaVM descriptor string of method     */
63         methoddesc   *parseddesc;       /* parsed descriptor                      */
64                              
65         classinfo    *class;            /* class, the method belongs to           */
66         s4            vftblindex;       /* index of method in virtual function    */
67                                         /* table (if it is a virtual method)      */
68         s4            maxstack;         /* maximum stack depth of method          */
69         s4            maxlocals;        /* maximum number of local variables      */
70         s4            jcodelength;      /* length of JavaVM code                  */
71         u1           *jcode;            /* pointer to JavaVM code                 */
72
73         s4            exceptiontablelength; /* exceptiontable length              */
74         exceptiontable *exceptiontable; /* the exceptiontable                     */
75
76         u2            thrownexceptionscount; /* number of exceptions attribute    */
77         classref_or_classinfo *thrownexceptions; /* except. a method may throw    */
78
79         u2            linenumbercount;  /* number of linenumber attributes        */
80         lineinfo     *linenumbers;      /* array of lineinfo items                */
81
82         int       c_block_nr;           /* a counter to number all BB with an     */
83                                         /* unique value                           */
84
85         u1           *stubroutine;      /* stub for compiling or calling natives  */
86         codeinfo     *code;             /* current code of this method            */
87
88 #if defined(ENABLE_LSRA)
89         s4            maxlifetimes;     /* helper for lsra                        */
90 #endif
91 };
92
93
94 /* exceptiontable *************************************************************/
95
96 struct exceptiontable {         /* exceptiontable entry in a method           */
97         s4              startpc;    /* start pc of guarded area (inclusive)       */
98         basicblock     *start;
99
100         s4              endpc;      /* end pc of guarded area (exklusive)         */
101         basicblock     *end;
102
103         s4              handlerpc;  /* pc of exception handler                    */
104         basicblock     *handler;
105
106         classref_or_classinfo catchtype; /* catchtype of exc. (NULL == catchall)  */
107         exceptiontable *next;       /* used to build a list of exception when     */
108                                     /* loops are copied */
109         exceptiontable *down;       /* instead of the old array, a list is used   */
110 };
111
112
113 /* lineinfo *******************************************************************/
114
115 struct lineinfo {
116         u2 start_pc;
117         u2 line_number;
118 };
119
120
121 /* function prototypes ********************************************************/
122
123 void method_free(methodinfo *m);
124 bool method_canoverwrite(methodinfo *m, methodinfo *old);
125
126 methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m);
127
128 #if !defined(NDEBUG)
129 void method_printflags(methodinfo *m);
130 void method_print(methodinfo *m);
131 void method_println(methodinfo *m);
132 void method_methodref_print(constant_FMIref *mr);
133 void method_methodref_println(constant_FMIref *mr);
134 #endif
135
136 #endif /* _METHOD_H */
137
138
139 /*
140  * These are local overrides for various environment variables in Emacs.
141  * Please do not remove this and leave it at the end of the file, where
142  * Emacs will automagically detect them.
143  * ---------------------------------------------------------------------
144  * Local variables:
145  * mode: c
146  * indent-tabs-mode: t
147  * c-basic-offset: 4
148  * tab-width: 4
149  * End:
150  * vim:noexpandtab:sw=4:ts=4:
151  */