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 941 2004-03-06 17:27:56Z jowenn $
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 * TYPECHECK_STATISTICS activates gathering statistical information.
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 TYPECHECK_STATISTICS*/
84 /*#define TYPEINFO_DEBUG*/
85 /*#define TYPECHECK_DEBUG*/
86 /*#define TYPEINFO_DEBUG_TEST*/
87 /*#define TYPECHECK_VERBOSE*/
88 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
89 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
90 #define TYPECHECK_VERBOSE_OPT
95 /* additional data types ******************************************************/
97 typedef void *voidptr; /* generic pointer */
99 typedef int bool; /* boolean data type */
105 /* immediate data union */
117 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
119 /* CAUTION: Don't change the numerical values! These constants are
120 * used as indices into the primitive type table.
122 #define PRIMITIVETYPE_INT 0
123 #define PRIMITIVETYPE_LONG 1
124 #define PRIMITIVETYPE_FLOAT 2
125 #define PRIMITIVETYPE_DOUBLE 3
126 #define PRIMITIVETYPE_BYTE 4
127 #define PRIMITIVETYPE_CHAR 5
128 #define PRIMITIVETYPE_SHORT 6
129 #define PRIMITIVETYPE_BOOLEAN 7
130 #define PRIMITIVETYPE_VOID 8
132 typedef void (*functionptr) (); /* generic function pointer */
135 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
137 /* shutdown function **********************************************************/
139 void cacao_shutdown(s4 status);
142 /* basic data types ***********************************************************/
144 /* CAUTION: jit/jit.h relies on these numerical values! */
145 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
146 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
147 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
148 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
149 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
154 /* Java class file constants **************************************************/
156 #define MAGIC 0xcafebabe
157 #define MINOR_VERSION 3
158 #define MAJOR_VERSION 45
160 #define CONSTANT_Class 7
161 #define CONSTANT_Fieldref 9
162 #define CONSTANT_Methodref 10
163 #define CONSTANT_InterfaceMethodref 11
164 #define CONSTANT_String 8
165 #define CONSTANT_Integer 3
166 #define CONSTANT_Float 4
167 #define CONSTANT_Long 5
168 #define CONSTANT_Double 6
169 #define CONSTANT_NameAndType 12
170 #define CONSTANT_Utf8 1
172 #define CONSTANT_UNUSED 0
174 #define ACC_PUBLIC 0x0001
175 #define ACC_PRIVATE 0x0002
176 #define ACC_PROTECTED 0x0004
177 #define ACC_STATIC 0x0008
178 #define ACC_FINAL 0x0010
179 #define ACC_SUPER 0x0020
180 #define ACC_SYNCHRONIZED 0x0020
181 #define ACC_VOLATILE 0x0040
182 #define ACC_TRANSIENT 0x0080
183 #define ACC_NATIVE 0x0100
184 #define ACC_INTERFACE 0x0200
185 #define ACC_ABSTRACT 0x0400
186 #define ACC_STRICT 0x0800
188 /* resolve typedef cycles *****************************************************/
190 typedef struct utf utf;
191 typedef struct literalstring literalstring;
192 typedef struct java_objectheader java_objectheader;
193 typedef struct classinfo classinfo;
194 typedef struct vftbl vftbl;
195 typedef u1* methodptr;
196 typedef struct fieldinfo fieldinfo;
197 typedef struct methodinfo methodinfo;
198 typedef struct lineinfo lineinfo;
199 typedef struct arraydescriptor arraydescriptor;
202 /* constant pool entries *******************************************************
204 All constant pool entries need a data structure which contain the entrys
205 value. In some cases this structure exist already, in the remaining cases
206 this structure must be generated:
208 kind structure generated?
209 ----------------------------------------------------------------------
210 CONSTANT_Class classinfo no
211 CONSTANT_Fieldref constant_FMIref yes
212 CONSTANT_Methodref constant_FMIref yes
213 CONSTANT_InterfaceMethodref constant_FMIref yes
214 CONSTANT_String unicode no
215 CONSTANT_Integer constant_integer yes
216 CONSTANT_Float constant_float yes
217 CONSTANT_Long constant_long yes
218 CONSTANT_Double constant_double yes
219 CONSTANT_NameAndType constant_nameandtype yes
220 CONSTANT_Utf8 unicode no
223 *******************************************************************************/
225 /* data structures for hashtables ********************************************
228 All utf-symbols, javastrings and classes are stored in global hashtables,
229 so every symbol exists only once. Equal symbols have identical pointers.
230 The functions for adding hashtable elements search the table for the
231 element with the specified name/text and return it on success. Otherwise a
232 new hashtable element is created.
234 The hashtables use external linking for handling collisions. The hashtable
235 structure contains a pointer <ptr> to the array of hashtable slots. The
236 number of hashtable slots and therefore the size of this array is specified
237 by the element <size> of hashtable structure. <entries> contains the number
238 of all hashtable elements stored in the table, including those in the
240 The hashtable element structures (utf, literalstring, classinfo) contain
241 both a pointer to the next hashtable element as a link for the external hash
242 chain and the key of the element. The key is computed from the text of
243 the string or the classname by using up to 8 characters.
245 If the number of entries in the hashtable exceeds twice the size of the
246 hashtableslot-array it is supposed that the average length of the
247 external chains has reached a value beyond 2. Therefore the functions for
248 adding hashtable elements (utf_new, class_new, literalstring_new) double
249 the hashtableslot-array. In this restructuring process all elements have
250 to be inserted into the new hashtable and new external chains must be built.
253 example for the layout of a hashtable:
255 hashtable.ptr--> +-------------------+
259 +-------------------+ +-------------------+ +-------------------+
260 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
261 +-------------------+ +-------------------+ +-------------------+
262 | hashtable element |
263 +-------------------+ +-------------------+
264 | hashtable element |-->| hashtable element |-->NULL
265 +-------------------+ +-------------------+
266 | hashtable element |-->NULL
267 +-------------------+
271 +-------------------+
276 /* data structure for utf8 symbols ********************************************/
279 utf *hashlink; /* link for external hash chain */
280 int blength; /* text length in bytes */
281 char *text; /* pointer to text */
285 /* data structure of internal javastrings stored in global hashtable **********/
287 struct literalstring {
288 literalstring *hashlink; /* link for external hash chain */
289 java_objectheader *string;
293 /* data structure for storing information needed for a stacktrace across native functions*/
294 struct native_stackframeinfo {
295 void *returnFromNative;
296 void *addrReturnFromNative;
298 struct native_stackframeinfo *next;
299 struct native_stackframeinfo *prev;
302 typedef struct native_stackframeinfo native_stackframeinfo;
304 /* data structure for calls from c code to java methods */
306 struct jni_callblock {
311 typedef struct jni_callblock jni_callblock;
314 /* data structure for accessing hashtables ************************************/
318 u4 entries; /* number of entries in the table */
319 void **ptr; /* pointer to hashtable */
323 /* data structures of remaining constant pool entries *************************/
325 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
326 classinfo *class; /* class containing this field/method/interface */
327 utf *name; /* field/method/interface name */
328 utf *descriptor; /* field/method/interface type descriptor string */
332 typedef struct { /* Integer */
337 typedef struct { /* Float */
342 typedef struct { /* Long */
347 typedef struct { /* Double */
352 typedef struct { /* NameAndType (Field or Method) */
353 utf *name; /* field/method name */
354 utf *descriptor; /* field/method type descriptor string */
355 } constant_nameandtype;
358 /* data structures of the runtime system **************************************/
360 /* objects *********************************************************************
362 All objects (and arrays) which resides on the heap need the following
363 header at the beginning of the data structure.
366 struct java_objectheader { /* header for all objects */
367 vftbl *vftbl; /* pointer to virtual function table */
372 /* arrays **********************************************************************
374 All arrays are objects (they need the object header with a pointer
375 to a vftbl (array class table). There is one class for each array
376 type. The array type is described by an arraydescriptor struct
377 which is referenced by the vftbl.
380 /* CAUTION: Don't change the numerical values! These constants (with
381 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
382 * primitive type table.
384 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
385 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
386 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
387 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
388 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
389 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
390 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
391 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
392 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
394 typedef struct java_arrayheader { /* header for all arrays */
395 java_objectheader objheader; /* object header */
396 s4 size; /* array size */
397 #ifdef SIZE_FROM_CLASSINFO
398 s4 alignedsize; /* phil */
404 /* structs for all kinds of arrays ********************************************/
406 typedef struct java_chararray {
407 java_arrayheader header;
411 typedef struct java_floatheader {
412 java_arrayheader header;
416 typedef struct java_doublearray {
417 java_arrayheader header;
421 /* booleanarray and bytearray need identical memory layout (access methods
422 use the same machine code */
424 typedef struct java_booleanarray {
425 java_arrayheader header;
429 typedef struct java_bytearray {
430 java_arrayheader header;
434 typedef struct java_shortarray {
435 java_arrayheader header;
439 typedef struct java_intarray {
440 java_arrayheader header;
444 typedef struct java_longarray {
445 java_arrayheader header;
449 /* objectarray and arrayarray need identical memory layout (access methods
450 use the same machine code */
452 typedef struct java_objectarray {
453 java_arrayheader header;
454 java_objectheader *data[1];
458 /* structure for primitive classes ********************************************/
460 typedef struct primitivetypeinfo {
461 classinfo *class_wrap; /* class for wrapping primitive type */
462 classinfo *class_primitive; /* primitive class */
463 char *wrapname; /* name of class for wrapping */
464 char typesig; /* one character type signature */
465 char *name; /* name of primitive class */
466 char *arrayname; /* name of primitive array class */
467 classinfo *arrayclass; /* primitive array class */
468 vftbl *arrayvftbl; /* vftbl of primitive array class */
472 /* field, method and class structures *****************************************/
475 typedef struct xtafldinfo {
477 classinfo *fldClassType;
478 classSet *XTAclassSet; /* field class type set */
482 /* fieldinfo ******************************************************************/
484 struct fieldinfo { /* field of a class */
485 s4 flags; /* ACC flags */
486 s4 type; /* basic data type */
487 utf *name; /* name of field */
488 utf *descriptor; /* JavaVM descriptor string of field */
490 s4 offset; /* offset from start of object (instance variables) */
492 imm_union value; /* storage for static values (class variables) */
494 classinfo *class; /* needed by typechecker. Could be optimized */
495 /* away by using constant_FMIref instead of */
496 /* fieldinfo throughout the compiler. */
504 /* exceptiontable *************************************************************/
506 typedef struct xtable { /* exceptiontable entry in a method */
507 s4 startpc; /* start pc of guarded area (inclusive) */
508 struct basicblock *start;
510 s4 endpc; /* end pc of guarded area (exklusive) */
511 struct basicblock *end;
513 s4 handlerpc; /* pc of exception handler */
514 struct basicblock *handler;
516 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
517 struct xtable *next; /* used to build a list of exception when */
518 /* loops are copied */
519 struct xtable *down; /* instead of the old array, a list is used */
523 typedef struct exceptiontable { /* exceptiontable entry in a method */
524 s4 startpc; /* start pc of guarded area (inclusive) */
525 s4 endpc; /* end pc of guarded area (exklusive) */
526 s4 handlerpc; /* pc of exception handler */
527 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
531 /* methodinfo static info ****************************************************/
532 typedef struct xtainfo {
533 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
534 classSet *XTAclassSet; /* method class type set */
535 /*classSet *PartClassSet */ /* method class type set */
537 classSetNode *paramClassSet; /* cone set of methods parameters */
539 methSet *calls; /* methods this method calls */
540 methSet *calledBy; /* methods that call this method */
541 methSet *marked; //not in Dez /* methods that marked by this method */
543 fldSet *fldsUsed; /* fields used by this method */
544 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
545 bool chgdSinceLastParse; /* Changed since last parse ? */
549 /* lineinfo *****************************************************************/
555 /* methodinfo *****************************************************************/
557 struct methodinfo { /* method structure */
558 s4 flags; /* ACC flags */
559 utf *name; /* name of method */
560 utf *descriptor; /* JavaVM descriptor string of method */
561 s4 returntype; /* only temporary valid, return type */
562 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
563 s4 paramcount; /* only temporary valid, parameter count */
564 u1 *paramtypes; /* only temporary valid, parameter types */
565 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
567 classinfo *class; /* class, the method belongs to */
568 s4 vftblindex; /* index of method in virtual function table
569 (if it is a virtual method) */
570 s4 maxstack; /* maximum stack depth of method */
571 s4 maxlocals; /* maximum number of local variables */
572 s4 jcodelength; /* length of JavaVM code */
573 u1 *jcode; /* pointer to JavaVM code */
575 s4 exceptiontablelength;/* exceptiontable length */
576 exceptiontable *exceptiontable; /* the exceptiontable */
578 u2 thrownexceptionscount; /*number of exceptions declared to be thrown by a method*/
579 classinfo **thrownexceptions; /*array of classinfos of declared exceptions*/
581 u2 linenumbercount; /*number of linenumber attributes*/
582 lineinfo *linenumbers; /*array of lineinfo items (start_pc,line_number)*/
584 u1 *stubroutine; /* stub for compiling or calling natives */
585 s4 mcodelength; /* legth of generated machine code */
586 u1 *mcode; /* pointer to machine code */
587 u1 *entrypoint; /* entry point in machine code */
592 s4 methodUsed; /* marked (might be used later) /not used /used */
593 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
594 /* should # method def'd and used be kept after static parse (will it be used?) */
600 /* innerclassinfo *************************************************************/
602 typedef struct innerclassinfo {
603 classinfo *inner_class; /* inner class pointer */
604 classinfo *outer_class; /* outer class pointer */
605 utf *name; /* innerclass name */
606 s4 flags; /* ACC flags */
610 /* classinfo ******************************************************************/
612 struct classinfo { /* class structure */
613 java_objectheader header; /* classes are also objects */
614 java_objectarray* signers;
615 struct java_security_ProtectionDomain* pd;
616 struct java_lang_VMClass* vmClass;
617 struct java_lang_reflect_Constructor* constructor;
620 s4 initializing_thread; /* gnu classpath */
621 s4 erroneous_state; /* gnu classpath */
622 struct gnu_classpath_RawData* vmData; /* gnu classpath */
624 s4 flags; /* ACC flags */
625 utf *name; /* class name */
627 s4 cpcount; /* number of entries in constant pool */
628 u1 *cptags; /* constant pool tags */
629 voidptr *cpinfos; /* pointer to constant pool info structures */
631 classinfo *super; /* super class pointer */
632 classinfo *sub; /* sub class pointer */
633 classinfo *nextsub; /* pointer to next class in sub class list */
635 s4 interfacescount; /* number of interfaces */
636 classinfo **interfaces; /* pointer to interfaces */
638 s4 fieldscount; /* number of fields */
639 fieldinfo *fields; /* field table */
641 s4 methodscount; /* number of methods */
642 methodinfo *methods; /* method table */
644 listnode listnode; /* linkage */
646 bool initialized; /* true, if class already initialised */
647 bool loaded; /* true, if class already loaded */
648 bool linked; /* true, if class already linked */
649 s4 index; /* hierarchy depth (classes) or index
651 s4 instancesize; /* size of an instance of this class */
652 #ifdef SIZE_FROM_CLASSINFO
653 s4 alignedsize; /* size of an instance, aligned to the
654 allocation size on the heap */
657 vftbl *vftbl; /* pointer to virtual function table */
659 methodinfo *finalizer; /* finalizer method */
661 u2 innerclasscount; /* number of inner classes */
662 innerclassinfo *innerclass;
664 classinfo *hashlink; /* link for external hash chain */
665 bool classvftbl; /* has its own copy of the Class vtbl */
667 s4 classUsed; /* 0= not used 1 = used CO-RT */
669 classSetNode *impldBy; /* implemented by class set */
670 utf *packagename; /* full name of the package */
671 java_objectheader *classloader; /* 0 for bootstrap classloader */
674 /* check if class is an array class. Only use for linked classes! */
675 #define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
678 /* virtual function table ******************************************************
680 The vtbl has a bidirectional layout with open ends at both sides.
681 interfacetablelength gives the number of entries of the interface table at
682 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
683 vftbllength gives the number of entries of table at the end of the vftbl.
685 runtime type check (checkcast):
687 Different methods are used for runtime type check depending on the
688 argument of checkcast/instanceof.
690 A check against a class is implemented via relative numbering on the class
691 hierachy tree. The tree is numbered in a depth first traversal setting
692 the base field and the diff field. The diff field gets the result of
693 (high - base) so that a range check can be implemented by an unsigned
694 compare. A sub type test is done by checking the inclusion of base of
695 the sub class in the range of the superclass.
697 A check against an interface is implemented via the interfacevftbl. If the
698 interfacevftbl contains a nonnull value a class is a subclass of this
703 Like standard virtual methods interface methods are called using
704 virtual function tables. All interfaces are numbered sequentially
705 (starting with zero). For each class there exist an interface table
706 of virtual function tables for each implemented interface. The length
707 of the interface table is determined by the highest number of an
708 implemented interface.
710 The following example assumes a class which implements interface 0 and 3:
712 interfacetablelength = 4
715 +-----------+ | method 2 |---> method z
716 | class | | method 1 |---> method y
717 +-----------+ | method 0 |---> method x
718 | ivftbl 0 |----------> +----------+
719 vftblptr ---> +-----------+
720 | ivftbl -1 |--> NULL +----------+
721 | ivftbl -2 |--> NULL | method 1 |---> method x
722 | ivftbl -3 |-----+ | method 0 |---> method a
723 +-----------+ +----> +----------+
730 interfacevftbllength ---> +---------------+
732 *******************************************************************************/
735 methodptr *interfacetable[1]; /* interface table (access via macro) */
737 classinfo *class; /* class, the vtbl belongs to */
739 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
741 s4 vftbllength; /* virtual function table length */
742 s4 interfacetablelength; /* interface table length */
744 s4 baseval; /* base for runtime type check */
745 /* (-index for interfaces) */
746 s4 diffval; /* high - base for runtime type check */
748 s4 *interfacevftbllength; /* length of interface vftbls */
750 methodptr table[1]; /* class vftbl */
753 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
756 /* arraydescriptor ************************************************************
758 For every array class an arraydescriptor is allocated which
759 describes the array class.
760 The arraydescriptor is referenced from the vftbl of the array
763 *******************************************************************************/
765 struct arraydescriptor {
766 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
767 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
768 short arraytype; /* ARRAYTYPE_* constant */
769 short dimension; /* dimension of the array (always >= 1) */
770 s4 dataoffset; /* offset of the array data from object pointer */
771 s4 componentsize; /* size of a component in bytes */
772 short elementtype; /* ARRAYTYPE_* constant */
776 /* references to some system classes ******************************************/
778 extern classinfo *class_java_lang_Object;
779 extern classinfo *class_java_lang_String;
780 extern classinfo *class_java_lang_Throwable;
781 extern classinfo *class_java_lang_Cloneable;
782 extern classinfo *class_java_io_Serializable;
783 extern classinfo *class_java_lang_ClassCastException;
784 extern classinfo *class_java_lang_NullPointerException;
785 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
786 extern classinfo *class_java_lang_NegativeArraySizeException;
787 extern classinfo *class_java_lang_OutOfMemoryError;
788 extern classinfo *class_java_lang_ArithmeticException;
789 extern classinfo *class_java_lang_ArrayStoreException;
790 extern classinfo *class_java_lang_ThreadDeath;
792 /* pseudo classes for the type checker ****************************************/
795 * pseudo_class_Arraystub
796 * (extends Object implements Cloneable, java.io.Serializable)
798 * If two arrays of incompatible component types are merged,
799 * the resulting reference has no accessible components.
800 * The result does, however, implement the interfaces Cloneable
801 * and java.io.Serializable. This pseudo class is used internally
802 * to represent such results. (They are *not* considered arrays!)
806 * This pseudo class is used internally to represent the
811 * This pseudo class is used internally to represent the
812 * the 'uninitialized object' type.
815 extern classinfo *pseudo_class_Arraystub;
816 extern classinfo *pseudo_class_Null;
817 extern classinfo *pseudo_class_New;
818 extern vftbl *pseudo_class_Arraystub_vftbl;
820 extern utf *array_packagename;
823 /* instances of some system classes *******************************************/
825 extern java_objectheader *proto_java_lang_ClassCastException;
826 extern java_objectheader *proto_java_lang_NullPointerException;
827 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
828 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
829 extern java_objectheader *proto_java_lang_OutOfMemoryError;
830 extern java_objectheader *proto_java_lang_ArithmeticException;
831 extern java_objectheader *proto_java_lang_ArrayStoreException;
832 extern java_objectheader *proto_java_lang_ThreadDeath;
835 /* flag variables *************************************************************/
837 extern bool compileall;
838 extern bool runverbose;
840 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
841 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
842 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
843 extern bool opt_verify; /* true if classfiles should be verified */
844 #ifdef TYPECHECK_VERBOSE_OPT
845 extern bool typecheckverbose;
848 /*extern int pClassHeir;*/
849 /*extern int pCallgraph;*/
850 /*extern int pOpcodes;*/
851 /*extern int pStats;*/
853 /*extern void RT_jit_parse(methodinfo *m);*/
856 /* statistic variables ********************************************************/
858 extern int count_class_infos;
859 extern int count_const_pool_len;
860 extern int count_vftbl_len;
861 extern int count_utf_len;
862 extern int count_all_methods;
863 extern int count_vmcode_len;
864 extern int count_extable_len;
865 extern int count_class_loads;
866 extern int count_class_inits;
867 extern int count_utf_new;
868 extern int count_utf_new_found;
871 /* table of primitive types ***************************************************/
873 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
874 * constants (except ARRAYTYPE_OBJECT).
876 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
879 /* macros for descriptor parsing **********************************************/
881 /* SKIP_FIELDDESCRIPTOR:
882 * utf_ptr must point to the first character of a field descriptor.
883 * After the macro call utf_ptr points to the first character after
884 * the field descriptor.
886 * CAUTION: This macro does not check for an unexpected end of the
887 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
889 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
890 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
891 if (*(utf_ptr)++=='L') \
892 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
894 /* SKIP_FIELDDESCRIPTOR_SAFE:
895 * utf_ptr must point to the first character of a field descriptor.
896 * After the macro call utf_ptr points to the first character after
897 * the field descriptor.
900 * utf_ptr....points to first char of descriptor
901 * end_ptr....points to first char after the end of the string
902 * errorflag..must be initialized (to false) by the caller!
904 * utf_ptr....points to first char after the descriptor
905 * errorflag..set to true if the string ended unexpectedly
907 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
908 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
909 if ((utf_ptr) == (end_ptr)) \
910 (errorflag) = true; \
912 if (*(utf_ptr)++=='L') { \
913 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
915 if ((utf_ptr)[-1] != ';') \
916 (errorflag) = true; }} while(0)
919 /* Synchronization ************************************************************/
921 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
922 extern pthread_mutex_t compiler_mutex;
923 extern int cast_counter;
930 #endif /* _GLOBAL_H */
934 * These are local overrides for various environment variables in Emacs.
935 * Please do not remove this and leave it at the end of the file, where
936 * Emacs will automagically detect them.
937 * ---------------------------------------------------------------------
940 * indent-tabs-mode: t