1 /* global.h - global definitions
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
5 M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
6 P. Tomsich, J. Wenninger
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
34 $Id: global.h 815 2003-12-31 13:22:44Z edwin $
44 #include "toolbox/list.h"
46 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
53 #define STATISTICS /* if enabled collects program statistics */
56 * SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
57 * of determining the sizes of objects on the heap.
59 #define SIZE_FROM_CLASSINFO
62 * CACAO_TYPECHECK activates typechecking (part of bytecode verification)
64 #define CACAO_TYPECHECK
67 * TYPECHECK_STACK_COMPCAT activates full checking of computational
68 * categories for stack manipulations (POP,POP2,SWAP,DUP,DUP2,DUP_X1,
69 * DUP2_X1,DUP_X2,DUP2_X2).
71 /* #define TYPECHECK_STACK_COMPCAT */
74 * Macros for configuration of the typechecking code
76 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
77 * TYPECHECK_DEBUG activates debug checks in typecheck.c
78 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
79 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
80 * TYPECHECK_VERBOSE activates all debug messages
82 #ifdef CACAO_TYPECHECK
83 #define TYPEINFO_DEBUG
84 #define TYPECHECK_DEBUG
85 /*#define TYPEINFO_DEBUG_TEST*/
86 #define TYPECHECK_VERBOSE
87 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
88 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
89 #define TYPECHECK_VERBOSE_OPT
94 /* additional data types ******************************************************/
96 typedef void *voidptr; /* generic pointer */
98 typedef int bool; /* boolean data type */
104 /* immediate data union */
116 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
118 /* CAUTION: Don't change the numerical values! These constants are
119 * used as indices into the primitive type table.
121 #define PRIMITIVETYPE_INT 0
122 #define PRIMITIVETYPE_LONG 1
123 #define PRIMITIVETYPE_FLOAT 2
124 #define PRIMITIVETYPE_DOUBLE 3
125 #define PRIMITIVETYPE_BYTE 4
126 #define PRIMITIVETYPE_CHAR 5
127 #define PRIMITIVETYPE_SHORT 6
128 #define PRIMITIVETYPE_BOOLEAN 7
129 #define PRIMITIVETYPE_VOID 8
131 typedef void (*functionptr) (); /* generic function pointer */
134 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
136 /* shutdown function **********************************************************/
138 void cacao_shutdown(s4 status);
141 /* basic data types ***********************************************************/
143 /* CAUTION: jit/jit.h relies on these numerical values! */
144 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
145 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
146 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
147 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
148 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
153 /* Java class file constants **************************************************/
155 #define MAGIC 0xcafebabe
156 #define MINOR_VERSION 3
157 #define MAJOR_VERSION 45
159 #define CONSTANT_Class 7
160 #define CONSTANT_Fieldref 9
161 #define CONSTANT_Methodref 10
162 #define CONSTANT_InterfaceMethodref 11
163 #define CONSTANT_String 8
164 #define CONSTANT_Integer 3
165 #define CONSTANT_Float 4
166 #define CONSTANT_Long 5
167 #define CONSTANT_Double 6
168 #define CONSTANT_NameAndType 12
169 #define CONSTANT_Utf8 1
171 #define CONSTANT_UNUSED 0
173 #define ACC_PUBLIC 0x0001
174 #define ACC_PRIVATE 0x0002
175 #define ACC_PROTECTED 0x0004
176 #define ACC_STATIC 0x0008
177 #define ACC_FINAL 0x0010
178 #define ACC_SUPER 0x0020
179 #define ACC_SYNCHRONIZED 0x0020
180 #define ACC_VOLATILE 0x0040
181 #define ACC_TRANSIENT 0x0080
182 #define ACC_NATIVE 0x0100
183 #define ACC_INTERFACE 0x0200
184 #define ACC_ABSTRACT 0x0400
185 #define ACC_STRICT 0x0800
187 /* resolve typedef cycles *****************************************************/
189 typedef struct utf utf;
190 typedef struct literalstring literalstring;
191 typedef struct java_objectheader java_objectheader;
192 typedef struct classinfo classinfo;
193 typedef struct vftbl vftbl;
194 typedef u1* methodptr;
195 typedef struct fieldinfo fieldinfo;
196 typedef struct methodinfo methodinfo;
197 typedef struct arraydescriptor arraydescriptor;
200 /* constant pool entries *******************************************************
202 All constant pool entries need a data structure which contain the entrys
203 value. In some cases this structure exist already, in the remaining cases
204 this structure must be generated:
206 kind structure generated?
207 ----------------------------------------------------------------------
208 CONSTANT_Class classinfo no
209 CONSTANT_Fieldref constant_FMIref yes
210 CONSTANT_Methodref constant_FMIref yes
211 CONSTANT_InterfaceMethodref constant_FMIref yes
212 CONSTANT_String unicode no
213 CONSTANT_Integer constant_integer yes
214 CONSTANT_Float constant_float yes
215 CONSTANT_Long constant_long yes
216 CONSTANT_Double constant_double yes
217 CONSTANT_NameAndType constant_nameandtype yes
218 CONSTANT_Utf8 unicode no
221 *******************************************************************************/
223 /* data structures for hashtables ********************************************
226 All utf-symbols, javastrings and classes are stored in global hashtables,
227 so every symbol exists only once. Equal symbols have identical pointers.
228 The functions for adding hashtable elements search the table for the
229 element with the specified name/text and return it on success. Otherwise a
230 new hashtable element is created.
232 The hashtables use external linking for handling collisions. The hashtable
233 structure contains a pointer <ptr> to the array of hashtable slots. The
234 number of hashtable slots and therefore the size of this array is specified
235 by the element <size> of hashtable structure. <entries> contains the number
236 of all hashtable elements stored in the table, including those in the
238 The hashtable element structures (utf, literalstring, classinfo) contain
239 both a pointer to the next hashtable element as a link for the external hash
240 chain and the key of the element. The key is computed from the text of
241 the string or the classname by using up to 8 characters.
243 If the number of entries in the hashtable exceeds twice the size of the
244 hashtableslot-array it is supposed that the average length of the
245 external chains has reached a value beyond 2. Therefore the functions for
246 adding hashtable elements (utf_new, class_new, literalstring_new) double
247 the hashtableslot-array. In this restructuring process all elements have
248 to be inserted into the new hashtable and new external chains must be built.
251 example for the layout of a hashtable:
253 hashtable.ptr--> +-------------------+
257 +-------------------+ +-------------------+ +-------------------+
258 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
259 +-------------------+ +-------------------+ +-------------------+
260 | hashtable element |
261 +-------------------+ +-------------------+
262 | hashtable element |-->| hashtable element |-->NULL
263 +-------------------+ +-------------------+
264 | hashtable element |-->NULL
265 +-------------------+
269 +-------------------+
274 /* data structure for utf8 symbols ********************************************/
277 utf *hashlink; /* link for external hash chain */
278 int blength; /* text length in bytes */
279 char *text; /* pointer to text */
283 /* data structure of internal javastrings stored in global hashtable **********/
285 struct literalstring {
286 literalstring *hashlink; /* link for external hash chain */
287 java_objectheader *string;
291 /* data structure for calls from c code to java methods */
293 struct jni_callblock {
298 typedef struct jni_callblock jni_callblock;
301 /* data structure for accessing hashtables ************************************/
305 u4 entries; /* number of entries in the table */
306 void **ptr; /* pointer to hashtable */
310 /* data structures of remaining constant pool entries *************************/
312 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
313 classinfo *class; /* class containing this field/method/interface */
314 utf *name; /* field/method/interface name */
315 utf *descriptor; /* field/method/interface type descriptor string */
319 typedef struct { /* Integer */
324 typedef struct { /* Float */
329 typedef struct { /* Long */
334 typedef struct { /* Double */
339 typedef struct { /* NameAndType (Field or Method) */
340 utf *name; /* field/method name */
341 utf *descriptor; /* field/method type descriptor string */
342 } constant_nameandtype;
345 /* data structures of the runtime system **************************************/
347 /* objects *********************************************************************
349 All objects (and arrays) which resides on the heap need the following
350 header at the beginning of the data structure.
353 struct java_objectheader { /* header for all objects */
354 vftbl *vftbl; /* pointer to virtual function table */
359 /* arrays **********************************************************************
361 All arrays are objects (they need the object header with a pointer
362 to a vftbl (array class table). There is one class for each array
363 type. The array type is described by an arraydescriptor struct
364 which is referenced by the vftbl.
367 /* CAUTION: Don't change the numerical values! These constants (with
368 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
369 * primitive type table.
371 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
372 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
373 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
374 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
375 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
376 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
377 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
378 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
379 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
381 typedef struct java_arrayheader { /* header for all arrays */
382 java_objectheader objheader; /* object header */
383 s4 size; /* array size */
384 #ifdef SIZE_FROM_CLASSINFO
385 s4 alignedsize; /* phil */
391 /* structs for all kinds of arrays ********************************************/
393 typedef struct java_chararray {
394 java_arrayheader header;
398 typedef struct java_floatheader {
399 java_arrayheader header;
403 typedef struct java_doublearray {
404 java_arrayheader header;
408 /* booleanarray and bytearray need identical memory layout (access methods
409 use the same machine code */
411 typedef struct java_booleanarray {
412 java_arrayheader header;
416 typedef struct java_bytearray {
417 java_arrayheader header;
421 typedef struct java_shortarray {
422 java_arrayheader header;
426 typedef struct java_intarray {
427 java_arrayheader header;
431 typedef struct java_longarray {
432 java_arrayheader header;
436 /* objectarray and arrayarray need identical memory layout (access methods
437 use the same machine code */
439 typedef struct java_objectarray {
440 java_arrayheader header;
441 java_objectheader *data[1];
445 /* structure for primitive classes ********************************************/
447 typedef struct primitivetypeinfo {
448 classinfo *class_wrap; /* class for wrapping primitive type */
449 classinfo *class_primitive; /* primitive class */
450 char *wrapname; /* name of class for wrapping */
451 char typesig; /* one character type signature */
452 char *name; /* name of primitive class */
453 char *arrayname; /* name of primitive array class */
454 classinfo *arrayclass; /* primitive array class */
455 vftbl *arrayvftbl; /* vftbl of primitive array class */
459 /* field, method and class structures *****************************************/
462 typedef struct xtafldinfo {
464 classinfo *fldClassType;
465 classSet *XTAclassSet; /* field class type set */
469 /* fieldinfo ******************************************************************/
471 struct fieldinfo { /* field of a class */
472 s4 flags; /* ACC flags */
473 s4 type; /* basic data type */
474 utf *name; /* name of field */
475 utf *descriptor; /* JavaVM descriptor string of field */
477 s4 offset; /* offset from start of object (instance variables) */
479 imm_union value; /* storage for static values (class variables) */
481 classinfo *class; /* XXX needed by typechecker. Could be optimized */
482 /* away by using constant_FMIref instead of */
483 /* fieldinfo throughout the compiler. */
491 /* exceptiontable *************************************************************/
493 typedef struct xtable { /* exceptiontable entry in a method */
494 s4 startpc; /* start pc of guarded area (inclusive) */
495 struct basicblock *start;
497 s4 endpc; /* end pc of guarded area (exklusive) */
498 struct basicblock *end;
500 s4 handlerpc; /* pc of exception handler */
501 struct basicblock *handler;
503 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
504 struct xtable *next; /* used to build a list of exception when */
505 /* loops are copied */
506 struct xtable *down; /* instead of the old array, a list is used */
510 typedef struct exceptiontable { /* exceptiontable entry in a method */
511 s4 startpc; /* start pc of guarded area (inclusive) */
512 s4 endpc; /* end pc of guarded area (exklusive) */
513 s4 handlerpc; /* pc of exception handler */
514 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
518 /* methodinfo static info ****************************************************/
519 typedef struct xtainfo {
520 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
521 classSet *XTAclassSet; /* method class type set */
522 /*classSet *PartClassSet */ /* method class type set */
524 classSetNode *paramClassSet; /* cone set of methods parameters */
526 methSet *calls; /* methods this method calls */
527 methSet *calledBy; /* methods that call this method */
528 methSet *marked; /* methods that marked by this method */
529 /*methSet *markedBy*/
530 fldSet *fldsUsed; /* fields used by this method */
531 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
532 bool chgdSinceLastParse; /* Changed since last parse ? */
536 /* methodinfo *****************************************************************/
538 struct methodinfo { /* method structure */
539 s4 flags; /* ACC flags */
540 utf *name; /* name of method */
541 utf *descriptor; /* JavaVM descriptor string of method */
542 s4 returntype; /* only temporary valid, return type */
543 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
544 s4 paramcount; /* only temporary valid, parameter count */
545 u1 *paramtypes; /* only temporary valid, parameter types */
546 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
548 classinfo *class; /* class, the method belongs to */
549 s4 vftblindex; /* index of method in virtual function table
550 (if it is a virtual method) */
551 s4 maxstack; /* maximum stack depth of method */
552 s4 maxlocals; /* maximum number of local variables */
553 s4 jcodelength; /* length of JavaVM code */
554 u1 *jcode; /* pointer to JavaVM code */
556 s4 exceptiontablelength;/* exceptiontable length */
557 exceptiontable *exceptiontable;
558 /* the exceptiontable */
560 u1 *stubroutine; /* stub for compiling or calling natives */
561 s4 mcodelength; /* legth of generated machine code */
562 u1 *mcode; /* pointer to machine code */
563 u1 *entrypoint; /* entry point in machine code */
568 s4 methodUsed; /* marked (might be used later) /not used /used */
569 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
570 /* should # method def'd and used be kept after static parse (will it be used?) */
576 /* innerclassinfo *************************************************************/
578 typedef struct innerclassinfo {
579 classinfo *inner_class; /* inner class pointer */
580 classinfo *outer_class; /* outer class pointer */
581 utf *name; /* innerclass name */
582 s4 flags; /* ACC flags */
586 /* classinfo ******************************************************************/
588 struct classinfo { /* class structure */
589 java_objectheader header; /* classes are also objects */
590 java_objectarray* signers;
591 struct java_security_ProtectionDomain* pd;
592 struct java_lang_VMClass* vmClass;
593 struct java_lang_reflect_Constructor* constructor;
596 s4 initializing_thread; /* gnu classpath */
597 s4 erroneous_state; /* gnu classpath */
598 struct gnu_classpath_RawData* vmData; /* gnu classpath */
600 s4 flags; /* ACC flags */
601 utf *name; /* class name */
603 s4 cpcount; /* number of entries in constant pool */
604 u1 *cptags; /* constant pool tags */
605 voidptr *cpinfos; /* pointer to constant pool info structures */
607 classinfo *super; /* super class pointer */
608 classinfo *sub; /* sub class pointer */
609 classinfo *nextsub; /* pointer to next class in sub class list */
611 s4 interfacescount; /* number of interfaces */
612 classinfo **interfaces; /* pointer to interfaces */
614 s4 fieldscount; /* number of fields */
615 fieldinfo *fields; /* field table */
617 s4 methodscount; /* number of methods */
618 methodinfo *methods; /* method table */
620 listnode listnode; /* linkage */
622 bool initialized; /* true, if class already initialised */
623 bool loaded; /* true, if class already loaded */
624 bool linked; /* true, if class already linked */
625 s4 index; /* hierarchy depth (classes) or index
627 s4 instancesize; /* size of an instance of this class */
628 #ifdef SIZE_FROM_CLASSINFO
629 s4 alignedsize; /* size of an instance, aligned to the
630 allocation size on the heap */
633 vftbl *vftbl; /* pointer to virtual function table */
635 methodinfo *finalizer; /* finalizer method */
637 u2 innerclasscount; /* number of inner classes */
638 innerclassinfo *innerclass;
640 classinfo *hashlink; /* link for external hash chain */
641 bool classvftbl; /* has its own copy of the Class vtbl */
643 s4 classUsed; /* 0= not used 1 = used CO-RT */
645 classSetNode *impldBy; /* implemented by class set */
648 /* check if class is an array class. Only use for linked classes! */
649 #define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
652 /* virtual function table ******************************************************
654 The vtbl has a bidirectional layout with open ends at both sides.
655 interfacetablelength gives the number of entries of the interface table at
656 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
657 vftbllength gives the number of entries of table at the end of the vftbl.
659 runtime type check (checkcast):
661 Different methods are used for runtime type check depending on the
662 argument of checkcast/instanceof.
664 A check against a class is implemented via relative numbering on the class
665 hierachy tree. The tree is numbered in a depth first traversal setting
666 the base field and the diff field. The diff field gets the result of
667 (high - base) so that a range check can be implemented by an unsigned
668 compare. A sub type test is done by checking the inclusion of base of
669 the sub class in the range of the superclass.
671 A check against an interface is implemented via the interfacevftbl. If the
672 interfacevftbl contains a nonnull value a class is a subclass of this
677 Like standard virtual methods interface methods are called using
678 virtual function tables. All interfaces are numbered sequentially
679 (starting with zero). For each class there exist an interface table
680 of virtual function tables for each implemented interface. The length
681 of the interface table is determined by the highest number of an
682 implemented interface.
684 The following example assumes a class which implements interface 0 and 3:
686 interfacetablelength = 4
689 +-----------+ | method 2 |---> method z
690 | class | | method 1 |---> method y
691 +-----------+ | method 0 |---> method x
692 | ivftbl 0 |----------> +----------+
693 vftblptr ---> +-----------+
694 | ivftbl -1 |--> NULL +----------+
695 | ivftbl -2 |--> NULL | method 1 |---> method x
696 | ivftbl -3 |-----+ | method 0 |---> method a
697 +-----------+ +----> +----------+
704 interfacevftbllength ---> +---------------+
706 *******************************************************************************/
709 methodptr *interfacetable[1]; /* interface table (access via macro) */
711 classinfo *class; /* class, the vtbl belongs to */
713 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
715 s4 vftbllength; /* virtual function table length */
716 s4 interfacetablelength; /* interface table length */
718 s4 baseval; /* base for runtime type check */
719 /* (-index for interfaces) */
720 s4 diffval; /* high - base for runtime type check */
722 s4 *interfacevftbllength; /* length of interface vftbls */
724 methodptr table[1]; /* class vftbl */
727 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
730 /* arraydescriptor ************************************************************
732 For every array class an arraydescriptor is allocated which
733 describes the array class.
734 The arraydescriptor is referenced from the vftbl of the array
737 *******************************************************************************/
739 struct arraydescriptor {
740 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
741 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
742 short arraytype; /* ARRAYTYPE_* constant */
743 short dimension; /* dimension of the array (always >= 1) */
744 s4 dataoffset; /* offset of the array data from object pointer */
745 s4 componentsize; /* size of a component in bytes */
746 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
750 /* references to some system classes ******************************************/
752 extern classinfo *class_java_lang_Object;
753 extern classinfo *class_java_lang_String;
754 extern classinfo *class_java_lang_Throwable;
755 extern classinfo *class_java_lang_Cloneable;
756 extern classinfo *class_java_io_Serializable;
757 extern classinfo *class_java_lang_ClassCastException;
758 extern classinfo *class_java_lang_NullPointerException;
759 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
760 extern classinfo *class_java_lang_NegativeArraySizeException;
761 extern classinfo *class_java_lang_OutOfMemoryError;
762 extern classinfo *class_java_lang_ArithmeticException;
763 extern classinfo *class_java_lang_ArrayStoreException;
764 extern classinfo *class_java_lang_ThreadDeath;
765 extern classinfo *pseudo_class_Arraystub;
766 extern classinfo *pseudo_class_Null;
767 extern classinfo *pseudo_class_New;
768 extern vftbl *pseudo_class_Arraystub_vftbl;
771 /* instances of some system classes *******************************************/
773 extern java_objectheader *proto_java_lang_ClassCastException;
774 extern java_objectheader *proto_java_lang_NullPointerException;
775 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
776 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
777 extern java_objectheader *proto_java_lang_OutOfMemoryError;
778 extern java_objectheader *proto_java_lang_ArithmeticException;
779 extern java_objectheader *proto_java_lang_ArrayStoreException;
780 extern java_objectheader *proto_java_lang_ThreadDeath;
783 /* flag variables *************************************************************/
785 extern bool compileall;
786 extern bool runverbose;
788 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
789 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
790 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
791 extern bool opt_verify; /* true if classfiles should be verified */
792 #ifdef TYPECHECK_VERBOSE_OPT
793 extern bool typecheckverbose;
796 /*extern int pClassHeir;*/
797 /*extern int pCallgraph;*/
798 /*extern int pOpcodes;*/
799 /*extern int pStats;*/
801 /*extern void RT_jit_parse(methodinfo *m);*/
804 /* statistic variables ********************************************************/
806 extern int count_class_infos;
807 extern int count_const_pool_len;
808 extern int count_vftbl_len;
809 extern int count_utf_len;
810 extern int count_all_methods;
811 extern int count_vmcode_len;
812 extern int count_extable_len;
813 extern int count_class_loads;
814 extern int count_class_inits;
815 extern int count_utf_new;
816 extern int count_utf_new_found;
819 /* table of primitive types ***************************************************/
821 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
822 * constants (except ARRAYTYPE_OBJECT).
824 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
827 /* macros for descriptor parsing **********************************************/
829 /* SKIP_FIELDDESCRIPTOR:
830 * utf_ptr must point to the first character of a field descriptor.
831 * After the macro call utf_ptr points to the first character after
832 * the field descriptor.
834 * CAUTION: This macro does not check for an unexpected end of the
835 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
837 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
838 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
839 if (*(utf_ptr)++=='L') \
840 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
842 /* SKIP_FIELDDESCRIPTOR_SAFE:
843 * utf_ptr must point to the first character of a field descriptor.
844 * After the macro call utf_ptr points to the first character after
845 * the field descriptor.
848 * utf_ptr....points to first char of descriptor
849 * end_ptr....points to first char after the end of the string
850 * errorflag..must be initialized (to false) by the caller!
852 * utf_ptr....points to first char after the descriptor
853 * errorflag..set to true if the string ended unexpectedly
855 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
856 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
857 if ((utf_ptr) == (end_ptr)) \
858 (errorflag) = true; \
860 if (*(utf_ptr)++=='L') { \
861 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
863 if ((utf_ptr)[-1] != ';') \
864 (errorflag) = true; }} while(0)
867 /* Synchronization ************************************************************/
869 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
870 extern pthread_mutex_t compiler_mutex;
871 extern int cast_counter;
877 #endif /* _GLOBAL_H */
881 * These are local overrides for various environment variables in Emacs.
882 * Please do not remove this and leave it at the end of the file, where
883 * Emacs will automagically detect them.
884 * ---------------------------------------------------------------------
887 * indent-tabs-mode: t