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 850 2004-01-05 23:58:39Z stefan $
46 #include "toolbox/list.h"
48 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
52 #define STATISTICS /* if enabled collects program statistics */
55 * SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
56 * of determining the sizes of objects on the heap.
58 #define SIZE_FROM_CLASSINFO
61 * CACAO_TYPECHECK activates typechecking (part of bytecode verification)
63 #define CACAO_TYPECHECK
66 * TYPECHECK_STACK_COMPCAT activates full checking of computational
67 * categories for stack manipulations (POP,POP2,SWAP,DUP,DUP2,DUP_X1,
68 * DUP2_X1,DUP_X2,DUP2_X2).
70 /* #define TYPECHECK_STACK_COMPCAT */
73 * Macros for configuration of the typechecking code
75 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
76 * TYPECHECK_DEBUG activates debug checks in typecheck.c
77 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
78 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
79 * TYPECHECK_VERBOSE activates all debug messages
81 #ifdef CACAO_TYPECHECK
82 #define TYPEINFO_DEBUG
83 #define TYPECHECK_DEBUG
84 /*#define TYPEINFO_DEBUG_TEST*/
85 #define TYPECHECK_VERBOSE
86 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
87 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
88 #define TYPECHECK_VERBOSE_OPT
93 /* additional data types ******************************************************/
95 typedef void *voidptr; /* generic pointer */
97 typedef int bool; /* boolean data type */
103 /* immediate data union */
115 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
117 /* CAUTION: Don't change the numerical values! These constants are
118 * used as indices into the primitive type table.
120 #define PRIMITIVETYPE_INT 0
121 #define PRIMITIVETYPE_LONG 1
122 #define PRIMITIVETYPE_FLOAT 2
123 #define PRIMITIVETYPE_DOUBLE 3
124 #define PRIMITIVETYPE_BYTE 4
125 #define PRIMITIVETYPE_CHAR 5
126 #define PRIMITIVETYPE_SHORT 6
127 #define PRIMITIVETYPE_BOOLEAN 7
128 #define PRIMITIVETYPE_VOID 8
130 typedef void (*functionptr) (); /* generic function pointer */
133 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
135 /* shutdown function **********************************************************/
137 void cacao_shutdown(s4 status);
140 /* basic data types ***********************************************************/
142 /* CAUTION: jit/jit.h relies on these numerical values! */
143 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
144 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
145 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
146 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
147 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
152 /* Java class file constants **************************************************/
154 #define MAGIC 0xcafebabe
155 #define MINOR_VERSION 3
156 #define MAJOR_VERSION 45
158 #define CONSTANT_Class 7
159 #define CONSTANT_Fieldref 9
160 #define CONSTANT_Methodref 10
161 #define CONSTANT_InterfaceMethodref 11
162 #define CONSTANT_String 8
163 #define CONSTANT_Integer 3
164 #define CONSTANT_Float 4
165 #define CONSTANT_Long 5
166 #define CONSTANT_Double 6
167 #define CONSTANT_NameAndType 12
168 #define CONSTANT_Utf8 1
170 #define CONSTANT_UNUSED 0
172 #define ACC_PUBLIC 0x0001
173 #define ACC_PRIVATE 0x0002
174 #define ACC_PROTECTED 0x0004
175 #define ACC_STATIC 0x0008
176 #define ACC_FINAL 0x0010
177 #define ACC_SUPER 0x0020
178 #define ACC_SYNCHRONIZED 0x0020
179 #define ACC_VOLATILE 0x0040
180 #define ACC_TRANSIENT 0x0080
181 #define ACC_NATIVE 0x0100
182 #define ACC_INTERFACE 0x0200
183 #define ACC_ABSTRACT 0x0400
184 #define ACC_STRICT 0x0800
186 /* resolve typedef cycles *****************************************************/
188 typedef struct utf utf;
189 typedef struct literalstring literalstring;
190 typedef struct java_objectheader java_objectheader;
191 typedef struct classinfo classinfo;
192 typedef struct vftbl vftbl;
193 typedef u1* methodptr;
194 typedef struct fieldinfo fieldinfo;
195 typedef struct methodinfo methodinfo;
196 typedef struct arraydescriptor arraydescriptor;
199 /* constant pool entries *******************************************************
201 All constant pool entries need a data structure which contain the entrys
202 value. In some cases this structure exist already, in the remaining cases
203 this structure must be generated:
205 kind structure generated?
206 ----------------------------------------------------------------------
207 CONSTANT_Class classinfo no
208 CONSTANT_Fieldref constant_FMIref yes
209 CONSTANT_Methodref constant_FMIref yes
210 CONSTANT_InterfaceMethodref constant_FMIref yes
211 CONSTANT_String unicode no
212 CONSTANT_Integer constant_integer yes
213 CONSTANT_Float constant_float yes
214 CONSTANT_Long constant_long yes
215 CONSTANT_Double constant_double yes
216 CONSTANT_NameAndType constant_nameandtype yes
217 CONSTANT_Utf8 unicode no
220 *******************************************************************************/
222 /* data structures for hashtables ********************************************
225 All utf-symbols, javastrings and classes are stored in global hashtables,
226 so every symbol exists only once. Equal symbols have identical pointers.
227 The functions for adding hashtable elements search the table for the
228 element with the specified name/text and return it on success. Otherwise a
229 new hashtable element is created.
231 The hashtables use external linking for handling collisions. The hashtable
232 structure contains a pointer <ptr> to the array of hashtable slots. The
233 number of hashtable slots and therefore the size of this array is specified
234 by the element <size> of hashtable structure. <entries> contains the number
235 of all hashtable elements stored in the table, including those in the
237 The hashtable element structures (utf, literalstring, classinfo) contain
238 both a pointer to the next hashtable element as a link for the external hash
239 chain and the key of the element. The key is computed from the text of
240 the string or the classname by using up to 8 characters.
242 If the number of entries in the hashtable exceeds twice the size of the
243 hashtableslot-array it is supposed that the average length of the
244 external chains has reached a value beyond 2. Therefore the functions for
245 adding hashtable elements (utf_new, class_new, literalstring_new) double
246 the hashtableslot-array. In this restructuring process all elements have
247 to be inserted into the new hashtable and new external chains must be built.
250 example for the layout of a hashtable:
252 hashtable.ptr--> +-------------------+
256 +-------------------+ +-------------------+ +-------------------+
257 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
258 +-------------------+ +-------------------+ +-------------------+
259 | hashtable element |
260 +-------------------+ +-------------------+
261 | hashtable element |-->| hashtable element |-->NULL
262 +-------------------+ +-------------------+
263 | hashtable element |-->NULL
264 +-------------------+
268 +-------------------+
273 /* data structure for utf8 symbols ********************************************/
276 utf *hashlink; /* link for external hash chain */
277 int blength; /* text length in bytes */
278 char *text; /* pointer to text */
282 /* data structure of internal javastrings stored in global hashtable **********/
284 struct literalstring {
285 literalstring *hashlink; /* link for external hash chain */
286 java_objectheader *string;
290 /* data structure for calls from c code to java methods */
292 struct jni_callblock {
297 typedef struct jni_callblock jni_callblock;
300 /* data structure for accessing hashtables ************************************/
304 u4 entries; /* number of entries in the table */
305 void **ptr; /* pointer to hashtable */
309 /* data structures of remaining constant pool entries *************************/
311 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
312 classinfo *class; /* class containing this field/method/interface */
313 utf *name; /* field/method/interface name */
314 utf *descriptor; /* field/method/interface type descriptor string */
318 typedef struct { /* Integer */
323 typedef struct { /* Float */
328 typedef struct { /* Long */
333 typedef struct { /* Double */
338 typedef struct { /* NameAndType (Field or Method) */
339 utf *name; /* field/method name */
340 utf *descriptor; /* field/method type descriptor string */
341 } constant_nameandtype;
344 /* data structures of the runtime system **************************************/
346 /* objects *********************************************************************
348 All objects (and arrays) which resides on the heap need the following
349 header at the beginning of the data structure.
352 struct java_objectheader { /* header for all objects */
353 vftbl *vftbl; /* pointer to virtual function table */
358 /* arrays **********************************************************************
360 All arrays are objects (they need the object header with a pointer
361 to a vftbl (array class table). There is one class for each array
362 type. The array type is described by an arraydescriptor struct
363 which is referenced by the vftbl.
366 /* CAUTION: Don't change the numerical values! These constants (with
367 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
368 * primitive type table.
370 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
371 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
372 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
373 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
374 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
375 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
376 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
377 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
378 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
380 typedef struct java_arrayheader { /* header for all arrays */
381 java_objectheader objheader; /* object header */
382 s4 size; /* array size */
383 #ifdef SIZE_FROM_CLASSINFO
384 s4 alignedsize; /* phil */
390 /* structs for all kinds of arrays ********************************************/
392 typedef struct java_chararray {
393 java_arrayheader header;
397 typedef struct java_floatheader {
398 java_arrayheader header;
402 typedef struct java_doublearray {
403 java_arrayheader header;
407 /* booleanarray and bytearray need identical memory layout (access methods
408 use the same machine code */
410 typedef struct java_booleanarray {
411 java_arrayheader header;
415 typedef struct java_bytearray {
416 java_arrayheader header;
420 typedef struct java_shortarray {
421 java_arrayheader header;
425 typedef struct java_intarray {
426 java_arrayheader header;
430 typedef struct java_longarray {
431 java_arrayheader header;
435 /* objectarray and arrayarray need identical memory layout (access methods
436 use the same machine code */
438 typedef struct java_objectarray {
439 java_arrayheader header;
440 java_objectheader *data[1];
444 /* structure for primitive classes ********************************************/
446 typedef struct primitivetypeinfo {
447 classinfo *class_wrap; /* class for wrapping primitive type */
448 classinfo *class_primitive; /* primitive class */
449 char *wrapname; /* name of class for wrapping */
450 char typesig; /* one character type signature */
451 char *name; /* name of primitive class */
452 char *arrayname; /* name of primitive array class */
453 classinfo *arrayclass; /* primitive array class */
454 vftbl *arrayvftbl; /* vftbl of primitive array class */
458 /* field, method and class structures *****************************************/
461 typedef struct xtafldinfo {
463 classinfo *fldClassType;
464 classSet *XTAclassSet; /* field class type set */
468 /* fieldinfo ******************************************************************/
470 struct fieldinfo { /* field of a class */
471 s4 flags; /* ACC flags */
472 s4 type; /* basic data type */
473 utf *name; /* name of field */
474 utf *descriptor; /* JavaVM descriptor string of field */
476 s4 offset; /* offset from start of object (instance variables) */
478 imm_union value; /* storage for static values (class variables) */
480 classinfo *class; /* XXX needed by typechecker. Could be optimized */
481 /* away by using constant_FMIref instead of */
482 /* fieldinfo throughout the compiler. */
490 /* exceptiontable *************************************************************/
492 typedef struct xtable { /* exceptiontable entry in a method */
493 s4 startpc; /* start pc of guarded area (inclusive) */
494 struct basicblock *start;
496 s4 endpc; /* end pc of guarded area (exklusive) */
497 struct basicblock *end;
499 s4 handlerpc; /* pc of exception handler */
500 struct basicblock *handler;
502 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
503 struct xtable *next; /* used to build a list of exception when */
504 /* loops are copied */
505 struct xtable *down; /* instead of the old array, a list is used */
509 typedef struct exceptiontable { /* exceptiontable entry in a method */
510 s4 startpc; /* start pc of guarded area (inclusive) */
511 s4 endpc; /* end pc of guarded area (exklusive) */
512 s4 handlerpc; /* pc of exception handler */
513 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
517 /* methodinfo static info ****************************************************/
518 typedef struct xtainfo {
519 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
520 classSet *XTAclassSet; /* method class type set */
521 /*classSet *PartClassSet */ /* method class type set */
523 classSetNode *paramClassSet; /* cone set of methods parameters */
525 methSet *calls; /* methods this method calls */
526 methSet *calledBy; /* methods that call this method */
527 methSet *marked; /* methods that marked by this method */
528 /*methSet *markedBy*/
529 fldSet *fldsUsed; /* fields used by this method */
530 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
531 bool chgdSinceLastParse; /* Changed since last parse ? */
535 /* methodinfo *****************************************************************/
537 struct methodinfo { /* method structure */
538 s4 flags; /* ACC flags */
539 utf *name; /* name of method */
540 utf *descriptor; /* JavaVM descriptor string of method */
541 s4 returntype; /* only temporary valid, return type */
542 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
543 s4 paramcount; /* only temporary valid, parameter count */
544 u1 *paramtypes; /* only temporary valid, parameter types */
545 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
547 classinfo *class; /* class, the method belongs to */
548 s4 vftblindex; /* index of method in virtual function table
549 (if it is a virtual method) */
550 s4 maxstack; /* maximum stack depth of method */
551 s4 maxlocals; /* maximum number of local variables */
552 s4 jcodelength; /* length of JavaVM code */
553 u1 *jcode; /* pointer to JavaVM code */
555 s4 exceptiontablelength;/* exceptiontable length */
556 exceptiontable *exceptiontable;
557 /* the exceptiontable */
559 u1 *stubroutine; /* stub for compiling or calling natives */
560 s4 mcodelength; /* legth of generated machine code */
561 u1 *mcode; /* pointer to machine code */
562 u1 *entrypoint; /* entry point in machine code */
567 s4 methodUsed; /* marked (might be used later) /not used /used */
568 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
569 /* should # method def'd and used be kept after static parse (will it be used?) */
575 /* innerclassinfo *************************************************************/
577 typedef struct innerclassinfo {
578 classinfo *inner_class; /* inner class pointer */
579 classinfo *outer_class; /* outer class pointer */
580 utf *name; /* innerclass name */
581 s4 flags; /* ACC flags */
585 /* classinfo ******************************************************************/
587 struct classinfo { /* class structure */
588 java_objectheader header; /* classes are also objects */
589 java_objectarray* signers;
590 struct java_security_ProtectionDomain* pd;
591 struct java_lang_VMClass* vmClass;
592 struct java_lang_reflect_Constructor* constructor;
595 s4 initializing_thread; /* gnu classpath */
596 s4 erroneous_state; /* gnu classpath */
597 struct gnu_classpath_RawData* vmData; /* gnu classpath */
599 s4 flags; /* ACC flags */
600 utf *name; /* class name */
602 s4 cpcount; /* number of entries in constant pool */
603 u1 *cptags; /* constant pool tags */
604 voidptr *cpinfos; /* pointer to constant pool info structures */
606 classinfo *super; /* super class pointer */
607 classinfo *sub; /* sub class pointer */
608 classinfo *nextsub; /* pointer to next class in sub class list */
610 s4 interfacescount; /* number of interfaces */
611 classinfo **interfaces; /* pointer to interfaces */
613 s4 fieldscount; /* number of fields */
614 fieldinfo *fields; /* field table */
616 s4 methodscount; /* number of methods */
617 methodinfo *methods; /* method table */
619 listnode listnode; /* linkage */
621 bool initialized; /* true, if class already initialised */
622 bool loaded; /* true, if class already loaded */
623 bool linked; /* true, if class already linked */
624 s4 index; /* hierarchy depth (classes) or index
626 s4 instancesize; /* size of an instance of this class */
627 #ifdef SIZE_FROM_CLASSINFO
628 s4 alignedsize; /* size of an instance, aligned to the
629 allocation size on the heap */
632 vftbl *vftbl; /* pointer to virtual function table */
634 methodinfo *finalizer; /* finalizer method */
636 u2 innerclasscount; /* number of inner classes */
637 innerclassinfo *innerclass;
639 classinfo *hashlink; /* link for external hash chain */
640 bool classvftbl; /* has its own copy of the Class vtbl */
642 s4 classUsed; /* 0= not used 1 = used CO-RT */
644 classSetNode *impldBy; /* implemented by class set */
647 /* check if class is an array class. Only use for linked classes! */
648 #define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
651 /* virtual function table ******************************************************
653 The vtbl has a bidirectional layout with open ends at both sides.
654 interfacetablelength gives the number of entries of the interface table at
655 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
656 vftbllength gives the number of entries of table at the end of the vftbl.
658 runtime type check (checkcast):
660 Different methods are used for runtime type check depending on the
661 argument of checkcast/instanceof.
663 A check against a class is implemented via relative numbering on the class
664 hierachy tree. The tree is numbered in a depth first traversal setting
665 the base field and the diff field. The diff field gets the result of
666 (high - base) so that a range check can be implemented by an unsigned
667 compare. A sub type test is done by checking the inclusion of base of
668 the sub class in the range of the superclass.
670 A check against an interface is implemented via the interfacevftbl. If the
671 interfacevftbl contains a nonnull value a class is a subclass of this
676 Like standard virtual methods interface methods are called using
677 virtual function tables. All interfaces are numbered sequentially
678 (starting with zero). For each class there exist an interface table
679 of virtual function tables for each implemented interface. The length
680 of the interface table is determined by the highest number of an
681 implemented interface.
683 The following example assumes a class which implements interface 0 and 3:
685 interfacetablelength = 4
688 +-----------+ | method 2 |---> method z
689 | class | | method 1 |---> method y
690 +-----------+ | method 0 |---> method x
691 | ivftbl 0 |----------> +----------+
692 vftblptr ---> +-----------+
693 | ivftbl -1 |--> NULL +----------+
694 | ivftbl -2 |--> NULL | method 1 |---> method x
695 | ivftbl -3 |-----+ | method 0 |---> method a
696 +-----------+ +----> +----------+
703 interfacevftbllength ---> +---------------+
705 *******************************************************************************/
708 methodptr *interfacetable[1]; /* interface table (access via macro) */
710 classinfo *class; /* class, the vtbl belongs to */
712 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
714 s4 vftbllength; /* virtual function table length */
715 s4 interfacetablelength; /* interface table length */
717 s4 baseval; /* base for runtime type check */
718 /* (-index for interfaces) */
719 s4 diffval; /* high - base for runtime type check */
721 s4 *interfacevftbllength; /* length of interface vftbls */
723 methodptr table[1]; /* class vftbl */
726 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
729 /* arraydescriptor ************************************************************
731 For every array class an arraydescriptor is allocated which
732 describes the array class.
733 The arraydescriptor is referenced from the vftbl of the array
736 *******************************************************************************/
738 struct arraydescriptor {
739 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
740 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
741 short arraytype; /* ARRAYTYPE_* constant */
742 short dimension; /* dimension of the array (always >= 1) */
743 s4 dataoffset; /* offset of the array data from object pointer */
744 s4 componentsize; /* size of a component in bytes */
745 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
749 /* references to some system classes ******************************************/
751 extern classinfo *class_java_lang_Object;
752 extern classinfo *class_java_lang_String;
753 extern classinfo *class_java_lang_Throwable;
754 extern classinfo *class_java_lang_Cloneable;
755 extern classinfo *class_java_io_Serializable;
756 extern classinfo *class_java_lang_ClassCastException;
757 extern classinfo *class_java_lang_NullPointerException;
758 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
759 extern classinfo *class_java_lang_NegativeArraySizeException;
760 extern classinfo *class_java_lang_OutOfMemoryError;
761 extern classinfo *class_java_lang_ArithmeticException;
762 extern classinfo *class_java_lang_ArrayStoreException;
763 extern classinfo *class_java_lang_ThreadDeath;
764 extern classinfo *pseudo_class_Arraystub;
765 extern classinfo *pseudo_class_Null;
766 extern classinfo *pseudo_class_New;
767 extern vftbl *pseudo_class_Arraystub_vftbl;
770 /* instances of some system classes *******************************************/
772 extern java_objectheader *proto_java_lang_ClassCastException;
773 extern java_objectheader *proto_java_lang_NullPointerException;
774 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
775 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
776 extern java_objectheader *proto_java_lang_OutOfMemoryError;
777 extern java_objectheader *proto_java_lang_ArithmeticException;
778 extern java_objectheader *proto_java_lang_ArrayStoreException;
779 extern java_objectheader *proto_java_lang_ThreadDeath;
782 /* flag variables *************************************************************/
784 extern bool compileall;
785 extern bool runverbose;
787 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
788 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
789 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
790 extern bool opt_verify; /* true if classfiles should be verified */
791 #ifdef TYPECHECK_VERBOSE_OPT
792 extern bool typecheckverbose;
795 /*extern int pClassHeir;*/
796 /*extern int pCallgraph;*/
797 /*extern int pOpcodes;*/
798 /*extern int pStats;*/
800 /*extern void RT_jit_parse(methodinfo *m);*/
803 /* statistic variables ********************************************************/
805 extern int count_class_infos;
806 extern int count_const_pool_len;
807 extern int count_vftbl_len;
808 extern int count_utf_len;
809 extern int count_all_methods;
810 extern int count_vmcode_len;
811 extern int count_extable_len;
812 extern int count_class_loads;
813 extern int count_class_inits;
814 extern int count_utf_new;
815 extern int count_utf_new_found;
818 /* table of primitive types ***************************************************/
820 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
821 * constants (except ARRAYTYPE_OBJECT).
823 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
826 /* macros for descriptor parsing **********************************************/
828 /* SKIP_FIELDDESCRIPTOR:
829 * utf_ptr must point to the first character of a field descriptor.
830 * After the macro call utf_ptr points to the first character after
831 * the field descriptor.
833 * CAUTION: This macro does not check for an unexpected end of the
834 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
836 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
837 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
838 if (*(utf_ptr)++=='L') \
839 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
841 /* SKIP_FIELDDESCRIPTOR_SAFE:
842 * utf_ptr must point to the first character of a field descriptor.
843 * After the macro call utf_ptr points to the first character after
844 * the field descriptor.
847 * utf_ptr....points to first char of descriptor
848 * end_ptr....points to first char after the end of the string
849 * errorflag..must be initialized (to false) by the caller!
851 * utf_ptr....points to first char after the descriptor
852 * errorflag..set to true if the string ended unexpectedly
854 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
855 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
856 if ((utf_ptr) == (end_ptr)) \
857 (errorflag) = true; \
859 if (*(utf_ptr)++=='L') { \
860 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
862 if ((utf_ptr)[-1] != ';') \
863 (errorflag) = true; }} while(0)
866 /* Synchronization ************************************************************/
868 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
869 extern pthread_mutex_t compiler_mutex;
870 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