1 /* src/vm/global.h - global definitions
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
36 $Id: global.h 4937 2006-05-18 14:33:32Z edwin $
48 /* additional data types ******************************************************/
50 typedef void *voidptr; /* generic pointer */
51 typedef void (*functionptr) (void); /* generic function pointer */
52 typedef u1* methodptr;
54 typedef int bool; /* boolean data type */
60 /* immediate data union */
73 /* forward typedefs ***********************************************************/
75 typedef struct java_objectheader java_objectheader;
76 typedef struct java_objectarray java_objectarray;
79 /* define some CACAO paths ****************************************************/
81 #if defined(ENABLE_ZLIB)
82 # define CACAO_VM_ZIP_PATH CACAO_PREFIX "/share/cacao/" VM_ZIP_STRING
84 # define CACAO_VM_ZIP_PATH CACAO_PREFIX "/share/cacao/"
87 #define CLASSPATH_GLIBJ_ZIP_PATH CLASSPATH_PREFIX "/share/classpath/" GLIBJ_ZIP_STRING
88 #define CLASSPATH_LIBRARY_PATH CLASSPATH_LIBDIR "/classpath"
91 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
94 /* basic data types ***********************************************************/
96 /* CAUTION: jit/jit.h relies on these numerical values! */
97 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
98 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
99 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
100 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
101 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
105 /* primitive data types *******************************************************/
107 /* These values are used in parsed descriptors and in some other
108 places were the different types handled internally as TYPE_INT have
109 to be distinguished. */
111 #define PRIMITIVETYPE_COUNT 11 /* number of primitive types (+ dummies) */
113 /* CAUTION: Don't change the numerical values! These constants are
114 used as indices into the primitive type table. */
116 #define PRIMITIVETYPE_INT TYPE_INT
117 #define PRIMITIVETYPE_LONG TYPE_LONG
118 #define PRIMITIVETYPE_FLOAT TYPE_FLOAT
119 #define PRIMITIVETYPE_DOUBLE TYPE_DOUBLE
120 #define PRIMITIVETYPE_DUMMY1 TYPE_ADR /* not used! */
121 #define PRIMITIVETYPE_BYTE 5
122 #define PRIMITIVETYPE_CHAR 6
123 #define PRIMITIVETYPE_SHORT 7
124 #define PRIMITIVETYPE_BOOLEAN 8
125 #define PRIMITIVETYPE_DUMMY2 9 /* not used! */
126 #define PRIMITIVETYPE_VOID TYPE_VOID
128 /* some Java related defines **************************************************/
130 #define JAVA_VERSION "1.4.2" /* this version is supported by CACAO */
131 #define CLASS_VERSION "49.0"
134 /* Java class file constants **************************************************/
136 #define MAGIC 0xCAFEBABE
137 #define MAJOR_VERSION 49
138 #define MINOR_VERSION 0
141 /* Constant pool tags *********************************************************/
143 #define CONSTANT_Class 7
144 #define CONSTANT_Fieldref 9
145 #define CONSTANT_Methodref 10
146 #define CONSTANT_InterfaceMethodref 11
147 #define CONSTANT_String 8
148 #define CONSTANT_Integer 3
149 #define CONSTANT_Float 4
150 #define CONSTANT_Long 5
151 #define CONSTANT_Double 6
152 #define CONSTANT_NameAndType 12
153 #define CONSTANT_Utf8 1
155 #define CONSTANT_UNUSED 0
158 /* Class/Field/Method access and property flags *******************************/
160 #define ACC_UNDEF -1 /* used internally */
161 #define ACC_NONE 0 /* used internally */
163 #define ACC_PUBLIC 0x0001
164 #define ACC_PRIVATE 0x0002
165 #define ACC_PROTECTED 0x0004
166 #define ACC_STATIC 0x0008
167 #define ACC_FINAL 0x0010
168 #define ACC_SUPER 0x0020
169 #define ACC_SYNCHRONIZED 0x0020
170 #define ACC_VOLATILE 0x0040
171 #define ACC_BRIDGE 0x0040
172 #define ACC_TRANSIENT 0x0080
173 #define ACC_VARARGS 0x0080
174 #define ACC_NATIVE 0x0100
175 #define ACC_INTERFACE 0x0200
176 #define ACC_ABSTRACT 0x0400
177 #define ACC_STRICT 0x0800
178 #define ACC_SYNTHETIC 0x1000
179 #define ACC_ANNOTATION 0x2000
180 #define ACC_ENUM 0x4000
181 #define ACC_MIRANDA 0x8000
183 /* special flags used in classinfo ********************************************/
185 #define ACC_CLASS_REFLECT_MASK 0x0000ffff /* flags reported by reflection */
186 #define ACC_CLASS_HAS_POINTERS 0x00010000 /* instance contains pointers */
189 /* data structures of the runtime system **************************************/
191 /* java_objectheader ***********************************************************
193 All objects (and arrays) which resides on the heap need the
194 following header at the beginning of the data structure.
196 *******************************************************************************/
198 struct java_objectheader { /* header for all objects */
199 struct _vftbl *vftbl; /* pointer to virtual function table */
200 #if defined(ENABLE_THREADS)
201 struct lock_record_t *monitorPtr;
202 ptrint flcword; /* word containing the FLC bit */
207 /* arrays **********************************************************************
209 All arrays are objects (they need the object header with a pointer
210 to a vftbl (array class table). There is one class for each array
211 type. The array type is described by an arraydescriptor struct
212 which is referenced by the vftbl.
215 /* CAUTION: Don't change the numerical values! These constants (with
216 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
217 * primitive type table.
219 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
220 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
221 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
222 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
223 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
224 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
225 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
226 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
227 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
229 typedef struct java_arrayheader { /* header for all arrays */
230 java_objectheader objheader; /* object header */
231 s4 size; /* array size */
236 /* structs for all kinds of arrays ********************************************/
238 /* booleanarray and bytearray need identical memory layout (access methods
239 use the same machine code */
241 typedef struct java_booleanarray {
242 java_arrayheader header;
246 typedef struct java_bytearray {
247 java_arrayheader header;
251 typedef struct java_chararray {
252 java_arrayheader header;
256 typedef struct java_shortarray {
257 java_arrayheader header;
261 typedef struct java_intarray {
262 java_arrayheader header;
266 typedef struct java_longarray {
267 java_arrayheader header;
271 typedef struct java_floatarray {
272 java_arrayheader header;
276 typedef struct java_doublearray {
277 java_arrayheader header;
281 /* objectarray and arrayarray need identical memory layout (access methods
282 use the same machine code */
284 struct java_objectarray {
285 java_arrayheader header;
286 java_objectheader *data[1];
290 /* Synchronization ************************************************************/
292 #if defined(ENABLE_THREADS)
293 void compiler_lock();
294 void compiler_unlock();
297 #endif /* _GLOBAL_H */
301 * These are local overrides for various environment variables in Emacs.
302 * Please do not remove this and leave it at the end of the file, where
303 * Emacs will automagically detect them.
304 * ---------------------------------------------------------------------
307 * indent-tabs-mode: t
311 * vim:noexpandtab:sw=4:ts=4: