1 /* vm/global.h - global definitions
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
35 $Id: global.h 1844 2005-01-04 11:21:18Z twisti $
47 /* resolve typedef cycles *****************************************************/
49 typedef struct utf utf;
50 typedef struct literalstring literalstring;
51 typedef struct java_objectheader java_objectheader;
52 typedef struct classinfo classinfo;
53 typedef struct _vftbl vftbl_t;
54 typedef u1* methodptr;
55 typedef struct fieldinfo fieldinfo;
56 typedef struct exceptiontable exceptiontable;
57 typedef struct methodinfo methodinfo;
58 typedef struct lineinfo lineinfo;
59 typedef struct arraydescriptor arraydescriptor;
62 /* additional data types ******************************************************/
64 typedef void *voidptr; /* generic pointer */
65 typedef void (*functionptr) (void); /* generic function pointer */
67 typedef int bool; /* boolean data type */
73 /* additional includes ********************************************************/
75 #include "toolbox/list.h"
76 #include "vm/jit/inline/sets.h"
79 /* define some cacao paths ****************************************************/
81 #define CACAO_LIBRARY_PATH "/jre/lib/"ARCH_DIR"/"
82 #define CACAO_RT_JAR_PATH "/jre/lib/rt.jar"
83 #define CACAO_EXT_DIR "/jre/lib/ext"
86 #define STATISTICS /* if enabled collects program statistics */
89 * SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
90 * of determining the sizes of objects on the heap.
92 #define SIZE_FROM_CLASSINFO
95 * CACAO_TYPECHECK activates typechecking (part of bytecode verification)
97 #define CACAO_TYPECHECK
100 * TYPECHECK_STACK_COMPCAT activates full checking of computational
101 * categories for stack manipulations (POP,POP2,SWAP,DUP,DUP2,DUP_X1,
102 * DUP2_X1,DUP_X2,DUP2_X2).
104 #define TYPECHECK_STACK_COMPCAT
107 * Macros for configuration of the typechecking code
109 * TYPECHECK_STATISTICS activates gathering statistical information.
110 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
111 * TYPECHECK_DEBUG activates debug checks in typecheck.c
112 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
113 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
114 * TYPECHECK_VERBOSE activates all debug messages
116 #ifdef CACAO_TYPECHECK
117 /*#define TYPECHECK_STATISTICS
118 #define TYPEINFO_DEBUG
119 #define TYPECHECK_DEBUG
120 #define TYPEINFO_DEBUG_TEST
121 #define TYPECHECK_VERBOSE
122 #define TYPECHECK_VERBOSE_IMPORTANT*/
123 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
124 #define TYPECHECK_VERBOSE_OPT
129 /* immediate data union */
142 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
144 /* CAUTION: Don't change the numerical values! These constants are
145 * used as indices into the primitive type table.
147 #define PRIMITIVETYPE_INT 0
148 #define PRIMITIVETYPE_LONG 1
149 #define PRIMITIVETYPE_FLOAT 2
150 #define PRIMITIVETYPE_DOUBLE 3
151 #define PRIMITIVETYPE_BYTE 4
152 #define PRIMITIVETYPE_CHAR 5
153 #define PRIMITIVETYPE_SHORT 6
154 #define PRIMITIVETYPE_BOOLEAN 7
155 #define PRIMITIVETYPE_VOID 8
158 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
161 /* basic data types ***********************************************************/
163 /* CAUTION: jit/jit.h relies on these numerical values! */
164 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
165 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
166 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
167 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
168 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
173 /* Java class file constants **************************************************/
175 #define MAGIC 0xcafebabe
176 #define MINOR_VERSION 0
177 #define MAJOR_VERSION 48
179 #define CONSTANT_Class 7
180 #define CONSTANT_Fieldref 9
181 #define CONSTANT_Methodref 10
182 #define CONSTANT_InterfaceMethodref 11
183 #define CONSTANT_String 8
184 #define CONSTANT_Integer 3
185 #define CONSTANT_Float 4
186 #define CONSTANT_Long 5
187 #define CONSTANT_Double 6
188 #define CONSTANT_NameAndType 12
189 #define CONSTANT_Utf8 1
191 #define CONSTANT_UNUSED 0
193 #define ACC_PUBLIC 0x0001
194 #define ACC_PRIVATE 0x0002
195 #define ACC_PROTECTED 0x0004
196 #define ACC_STATIC 0x0008
197 #define ACC_FINAL 0x0010
198 #define ACC_SUPER 0x0020
199 #define ACC_SYNCHRONIZED 0x0020
200 #define ACC_VOLATILE 0x0040
201 #define ACC_TRANSIENT 0x0080
202 #define ACC_NATIVE 0x0100
203 #define ACC_INTERFACE 0x0200
204 #define ACC_ABSTRACT 0x0400
205 #define ACC_STRICT 0x0800
208 /* constant pool entries *******************************************************
210 All constant pool entries need a data structure which contain the entrys
211 value. In some cases this structure exist already, in the remaining cases
212 this structure must be generated:
214 kind structure generated?
215 ----------------------------------------------------------------------
216 CONSTANT_Class classinfo no
217 CONSTANT_Fieldref constant_FMIref yes
218 CONSTANT_Methodref constant_FMIref yes
219 CONSTANT_InterfaceMethodref constant_FMIref yes
220 CONSTANT_String unicode no
221 CONSTANT_Integer constant_integer yes
222 CONSTANT_Float constant_float yes
223 CONSTANT_Long constant_long yes
224 CONSTANT_Double constant_double yes
225 CONSTANT_NameAndType constant_nameandtype yes
226 CONSTANT_Utf8 unicode no
229 *******************************************************************************/
231 /* data structures for hashtables ********************************************
234 All utf-symbols, javastrings and classes are stored in global hashtables,
235 so every symbol exists only once. Equal symbols have identical pointers.
236 The functions for adding hashtable elements search the table for the
237 element with the specified name/text and return it on success. Otherwise a
238 new hashtable element is created.
240 The hashtables use external linking for handling collisions. The hashtable
241 structure contains a pointer <ptr> to the array of hashtable slots. The
242 number of hashtable slots and therefore the size of this array is specified
243 by the element <size> of hashtable structure. <entries> contains the number
244 of all hashtable elements stored in the table, including those in the
246 The hashtable element structures (utf, literalstring, classinfo) contain
247 both a pointer to the next hashtable element as a link for the external hash
248 chain and the key of the element. The key is computed from the text of
249 the string or the classname by using up to 8 characters.
251 If the number of entries in the hashtable exceeds twice the size of the
252 hashtableslot-array it is supposed that the average length of the
253 external chains has reached a value beyond 2. Therefore the functions for
254 adding hashtable elements (utf_new, class_new, literalstring_new) double
255 the hashtableslot-array. In this restructuring process all elements have
256 to be inserted into the new hashtable and new external chains must be built.
259 example for the layout of a hashtable:
261 hashtable.ptr--> +-------------------+
265 +-------------------+ +-------------------+ +-------------------+
266 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
267 +-------------------+ +-------------------+ +-------------------+
268 | hashtable element |
269 +-------------------+ +-------------------+
270 | hashtable element |-->| hashtable element |-->NULL
271 +-------------------+ +-------------------+
272 | hashtable element |-->NULL
273 +-------------------+
277 +-------------------+
282 /* data structure for utf8 symbols ********************************************/
285 utf *hashlink; /* link for external hash chain */
286 int blength; /* text length in bytes */
287 char *text; /* pointer to text */
291 /* data structure of internal javastrings stored in global hashtable **********/
293 struct literalstring {
294 literalstring *hashlink; /* link for external hash chain */
295 java_objectheader *string;
299 /* data structure for storing information needed for a stacktrace across native functions*/
301 typedef struct native_stackframeinfo native_stackframeinfo;
303 struct native_stackframeinfo {
304 void *oldThreadspecificHeadValue;
305 void **addressOfThreadspecificHead;
310 void *beginOfJavaStackframe; /*only used if != 0*/
311 void *returnToFromNative;
314 void *returnFromNative;
315 void *addrReturnFromNative;
317 struct native_stackframeinfo *next;
318 struct native_stackframeinfo *prev;
323 typedef struct stacktraceelement stacktraceelement;
325 struct stacktraceelement {
335 typedef struct stackTraceBuffer stackTraceBuffer;
337 struct stackTraceBuffer {
339 stacktraceelement *start;
346 /* data structure for calls from c code to java methods */
348 struct jni_callblock {
353 typedef struct jni_callblock jni_callblock;
356 /* data structure for accessing hashtables ************************************/
360 u4 entries; /* number of entries in the table */
361 void **ptr; /* pointer to hashtable */
365 /* data structures of remaining constant pool entries *************************/
367 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
368 classinfo *class; /* class containing this field/method/interface */
369 utf *name; /* field/method/interface name */
370 utf *descriptor; /* field/method/interface type descriptor string */
374 typedef struct { /* Integer */
379 typedef struct { /* Float */
384 typedef struct { /* Long */
389 typedef struct { /* Double */
394 typedef struct { /* NameAndType (Field or Method) */
395 utf *name; /* field/method name */
396 utf *descriptor; /* field/method type descriptor string */
397 } constant_nameandtype;
400 /* data structures of the runtime system **************************************/
402 /* objects *********************************************************************
404 All objects (and arrays) which resides on the heap need the following
405 header at the beginning of the data structure.
408 struct java_objectheader { /* header for all objects */
409 vftbl_t *vftbl; /* pointer to virtual function table */
410 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
417 /* arrays **********************************************************************
419 All arrays are objects (they need the object header with a pointer
420 to a vftbl (array class table). There is one class for each array
421 type. The array type is described by an arraydescriptor struct
422 which is referenced by the vftbl.
425 /* CAUTION: Don't change the numerical values! These constants (with
426 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
427 * primitive type table.
429 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
430 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
431 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
432 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
433 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
434 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
435 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
436 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
437 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
439 typedef struct java_arrayheader { /* header for all arrays */
440 java_objectheader objheader; /* object header */
441 s4 size; /* array size */
442 #ifdef SIZE_FROM_CLASSINFO
443 s4 alignedsize; /* phil */
449 /* structs for all kinds of arrays ********************************************/
451 typedef struct java_chararray {
452 java_arrayheader header;
456 typedef struct java_floatheader {
457 java_arrayheader header;
461 typedef struct java_doublearray {
462 java_arrayheader header;
466 /* booleanarray and bytearray need identical memory layout (access methods
467 use the same machine code */
469 typedef struct java_booleanarray {
470 java_arrayheader header;
474 typedef struct java_bytearray {
475 java_arrayheader header;
479 typedef struct java_shortarray {
480 java_arrayheader header;
484 typedef struct java_intarray {
485 java_arrayheader header;
489 typedef struct java_longarray {
490 java_arrayheader header;
494 /* objectarray and arrayarray need identical memory layout (access methods
495 use the same machine code */
497 typedef struct java_objectarray {
498 java_arrayheader header;
499 java_objectheader *data[1];
503 /* structure for primitive classes ********************************************/
505 typedef struct primitivetypeinfo {
506 classinfo *class_wrap; /* class for wrapping primitive type */
507 classinfo *class_primitive; /* primitive class */
508 char *wrapname; /* name of class for wrapping */
509 char typesig; /* one character type signature */
510 char *name; /* name of primitive class */
511 char *arrayname; /* name of primitive array class */
512 classinfo *arrayclass; /* primitive array class */
513 vftbl_t *arrayvftbl; /* vftbl of primitive array class */
517 /* field, method and class structures *****************************************/
519 typedef struct xtafldinfo {
521 classinfo *fldClassType;
522 classSet *XTAclassSet; /* field class type set */
526 /* fieldinfo ******************************************************************/
528 struct fieldinfo { /* field of a class */
529 s4 flags; /* ACC flags */
530 s4 type; /* basic data type */
531 utf *name; /* name of field */
532 utf *descriptor; /* JavaVM descriptor string of field */
534 s4 offset; /* offset from start of object (instance variables) */
536 imm_union value; /* storage for static values (class variables) */
538 classinfo *class; /* needed by typechecker. Could be optimized */
539 /* away by using constant_FMIref instead of */
540 /* fieldinfo throughout the compiler. */
546 /* exceptiontable *************************************************************/
548 struct exceptiontable { /* exceptiontable entry in a method */
549 s4 startpc; /* start pc of guarded area (inclusive) */
550 struct basicblock *start;
552 s4 endpc; /* end pc of guarded area (exklusive) */
553 struct basicblock *end;
555 s4 handlerpc; /* pc of exception handler */
556 struct basicblock *handler;
558 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
559 exceptiontable *next; /* used to build a list of exception when */
560 /* loops are copied */
561 exceptiontable *down; /* instead of the old array, a list is used */
565 /* methodinfo static info ****************************************************/
567 typedef struct xtainfo {
568 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
569 classSet *XTAclassSet; /* method class type set */
570 /*classSet *PartClassSet */ /* method class type set */
572 classSetNode *paramClassSet; /* cone set of methods parameters */
574 methSet *calls; /* methods this method calls */
575 methSet *calledBy; /* methods that call this method */
576 methSet *marked; /*not in Dez*/ /* methods that marked by this method */
578 fldSet *fldsUsed; /* fields used by this method */
579 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
580 bool chgdSinceLastParse; /* Changed since last parse ? */
584 /* lineinfo *****************************************************************/
592 /* methodinfo *****************************************************************/
594 struct methodinfo { /* method structure */
595 java_objectheader header; /* we need this in jit's monitorenter */
596 s4 flags; /* ACC flags */
597 utf *name; /* name of method */
598 utf *descriptor; /* JavaVM descriptor string of method */
599 s4 returntype; /* only temporary valid, return type */
600 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
601 s4 paramcount; /* only temporary valid, parameter count */
602 u1 *paramtypes; /* only temporary valid, parameter types */
603 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
605 bool isleafmethod; /* does method call subroutines */
607 classinfo *class; /* class, the method belongs to */
608 s4 vftblindex; /* index of method in virtual function */
609 /* table (if it is a virtual method) */
610 s4 maxstack; /* maximum stack depth of method */
611 s4 maxlocals; /* maximum number of local variables */
612 s4 jcodelength; /* length of JavaVM code */
613 u1 *jcode; /* pointer to JavaVM code */
615 s4 basicblockcount; /* number of basic blocks */
616 struct basicblock *basicblocks; /* points to basic block array */
617 s4 *basicblockindex; /* a table which contains for every byte */
618 /* of JavaVM code a basic block index if */
619 /* at this byte is the start of a basic */
622 s4 instructioncount; /* number of JavaVM instructions */
623 struct instruction *instructions; /* points to intermediate code instructions */
625 s4 stackcount; /* number of stack elements */
626 struct stackelement *stack; /* points to intermediate code instructions */
628 s4 exceptiontablelength;/* exceptiontable length */
629 exceptiontable *exceptiontable; /* the exceptiontable */
631 u2 thrownexceptionscount;/* number of exceptions attribute */
632 classinfo **thrownexceptions; /* checked exceptions a method may throw */
634 u2 linenumbercount; /* number of linenumber attributes */
635 lineinfo *linenumbers; /* array of lineinfo items */
637 int c_debug_nr; /* a counter to number all BB with an */
640 u1 *stubroutine; /* stub for compiling or calling natives */
641 s4 mcodelength; /* legth of generated machine code */
642 functionptr mcode; /* pointer to machine code */
643 functionptr entrypoint; /* entry point in machine code */
648 s4 methodUsed; /* marked (might be used later) /not used /used */
649 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
650 /* should # method def'd and used be kept after static parse (will it be used?) */
653 s4 nativelyoverloaded; /* used in header.c and only valid there */
657 /* innerclassinfo *************************************************************/
659 typedef struct innerclassinfo {
660 classinfo *inner_class; /* inner class pointer */
661 classinfo *outer_class; /* outer class pointer */
662 utf *name; /* innerclass name */
663 s4 flags; /* ACC flags */
667 /* classinfo ******************************************************************/
669 struct classinfo { /* class structure */
670 java_objectheader header; /* classes are also objects */
671 java_objectarray* signers;
672 struct java_security_ProtectionDomain* pd;
673 struct java_lang_VMClass* vmClass;
674 struct java_lang_reflect_Constructor* constructor;
676 s4 initializing_thread; /* gnu classpath */
677 s4 erroneous_state; /* gnu classpath */
678 struct gnu_classpath_RawData* vmData; /* gnu classpath */
680 s4 flags; /* ACC flags */
681 utf *name; /* class name */
683 s4 cpcount; /* number of entries in constant pool */
684 u1 *cptags; /* constant pool tags */
685 voidptr *cpinfos; /* pointer to constant pool info structures */
687 classinfo *super; /* super class pointer */
688 classinfo *sub; /* sub class pointer */
689 classinfo *nextsub; /* pointer to next class in sub class list */
691 s4 interfacescount; /* number of interfaces */
692 classinfo **interfaces; /* pointer to interfaces */
694 s4 fieldscount; /* number of fields */
695 fieldinfo *fields; /* field table */
697 s4 methodscount; /* number of methods */
698 methodinfo *methods; /* method table */
700 listnode listnode; /* linkage */
702 bool initialized; /* true, if class already initialized */
703 bool initializing; /* flag for the compiler */
704 bool loaded; /* true, if class already loaded */
705 bool linked; /* true, if class already linked */
706 s4 index; /* hierarchy depth (classes) or index */
708 s4 instancesize; /* size of an instance of this class */
709 #ifdef SIZE_FROM_CLASSINFO
710 s4 alignedsize; /* size of an instance, aligned to the */
711 /* allocation size on the heap */
714 vftbl_t *vftbl; /* pointer to virtual function table */
716 methodinfo *finalizer; /* finalizer method */
718 u2 innerclasscount; /* number of inner classes */
719 innerclassinfo *innerclass;
721 classinfo *hashlink; /* link for external hash chain */
722 bool classvftbl; /* has its own copy of the Class vtbl */
724 s4 classUsed; /* 0= not used 1 = used CO-RT */
726 classSetNode *impldBy; /* implemented by class set */
727 utf *packagename; /* full name of the package */
728 utf *sourcefile; /* classfile name containing this class */
729 java_objectheader *classloader; /* NULL for bootstrap classloader */
732 /* check if class is an array class. Only use for linked classes! */
733 #define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
736 /* virtual function table ******************************************************
738 The vtbl has a bidirectional layout with open ends at both sides.
739 interfacetablelength gives the number of entries of the interface table at
740 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
741 vftbllength gives the number of entries of table at the end of the vftbl.
743 runtime type check (checkcast):
745 Different methods are used for runtime type check depending on the
746 argument of checkcast/instanceof.
748 A check against a class is implemented via relative numbering on the class
749 hierachy tree. The tree is numbered in a depth first traversal setting
750 the base field and the diff field. The diff field gets the result of
751 (high - base) so that a range check can be implemented by an unsigned
752 compare. A sub type test is done by checking the inclusion of base of
753 the sub class in the range of the superclass.
755 A check against an interface is implemented via the interfacevftbl. If the
756 interfacevftbl contains a nonnull value a class is a subclass of this
761 Like standard virtual methods interface methods are called using
762 virtual function tables. All interfaces are numbered sequentially
763 (starting with zero). For each class there exist an interface table
764 of virtual function tables for each implemented interface. The length
765 of the interface table is determined by the highest number of an
766 implemented interface.
768 The following example assumes a class which implements interface 0 and 3:
770 interfacetablelength = 4
773 +-----------+ | method 2 |---> method z
774 | class | | method 1 |---> method y
775 +-----------+ | method 0 |---> method x
776 | ivftbl 0 |----------> +----------+
777 vftblptr ---> +-----------+
778 | ivftbl -1 |--> NULL +----------+
779 | ivftbl -2 |--> NULL | method 1 |---> method x
780 | ivftbl -3 |-----+ | method 0 |---> method a
781 +-----------+ +----> +----------+
788 interfacevftbllength ---> +---------------+
790 *******************************************************************************/
793 methodptr *interfacetable[1]; /* interface table (access via macro) */
795 classinfo *class; /* class, the vtbl belongs to */
797 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
799 s4 vftbllength; /* virtual function table length */
800 s4 interfacetablelength; /* interface table length */
802 s4 baseval; /* base for runtime type check */
803 /* (-index for interfaces) */
804 s4 diffval; /* high - base for runtime type check */
806 s4 *interfacevftbllength; /* length of interface vftbls */
808 methodptr table[1]; /* class vftbl */
811 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
814 /* arraydescriptor ************************************************************
816 For every array class an arraydescriptor is allocated which
817 describes the array class.
818 The arraydescriptor is referenced from the vftbl of the array
821 *******************************************************************************/
823 struct arraydescriptor {
824 vftbl_t *componentvftbl; /* vftbl of the component type, NULL for primit. */
825 vftbl_t *elementvftbl; /* vftbl of the element type, NULL for primitive */
826 s2 arraytype; /* ARRAYTYPE_* constant */
827 s2 dimension; /* dimension of the array (always >= 1) */
828 s4 dataoffset; /* offset of the array data from object pointer */
829 s4 componentsize; /* size of a component in bytes */
830 s2 elementtype; /* ARRAYTYPE_* constant */
834 /* flag variables *************************************************************/
836 extern bool cacao_initializing;
838 #ifdef TYPECHECK_VERBOSE_OPT
839 extern bool typecheckverbose;
842 /*extern int pClassHeir;*/
843 /*extern int pCallgraph;*/
844 /*extern int pOpcodes;*/
845 /*extern int pStats;*/
847 /*extern void RT_jit_parse(methodinfo *m);*/
850 /* table of primitive types ***************************************************/
852 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
853 * constants (except ARRAYTYPE_OBJECT).
855 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
858 /* macros for descriptor parsing **********************************************/
860 /* SKIP_FIELDDESCRIPTOR:
861 * utf_ptr must point to the first character of a field descriptor.
862 * After the macro call utf_ptr points to the first character after
863 * the field descriptor.
865 * CAUTION: This macro does not check for an unexpected end of the
866 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
868 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
869 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
870 if (*(utf_ptr)++=='L') \
871 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
873 /* SKIP_FIELDDESCRIPTOR_SAFE:
874 * utf_ptr must point to the first character of a field descriptor.
875 * After the macro call utf_ptr points to the first character after
876 * the field descriptor.
879 * utf_ptr....points to first char of descriptor
880 * end_ptr....points to first char after the end of the string
881 * errorflag..must be initialized (to false) by the caller!
883 * utf_ptr....points to first char after the descriptor
884 * errorflag..set to true if the string ended unexpectedly
886 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
887 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
888 if ((utf_ptr) == (end_ptr)) \
889 (errorflag) = true; \
891 if (*(utf_ptr)++=='L') { \
892 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
894 if ((utf_ptr)[-1] != ';') \
895 (errorflag) = true; }} while(0)
898 /* Synchronization ************************************************************/
900 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
903 void compiler_lock();
904 void compiler_unlock();
907 #endif /* _GLOBAL_H */
911 * These are local overrides for various environment variables in Emacs.
912 * Please do not remove this and leave it at the end of the file, where
913 * Emacs will automagically detect them.
914 * ---------------------------------------------------------------------
917 * indent-tabs-mode: t