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 812 2003-12-31 00:11:12Z 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 * Macros for configuration of the typechecking code
69 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
70 * TYPECHECK_DEBUG activates debug checks in typecheck.c
71 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
72 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
73 * TYPECHECK_VERBOSE activates all debug messages
75 #ifdef CACAO_TYPECHECK
76 #define TYPEINFO_DEBUG
77 #define TYPECHECK_DEBUG
78 /*#define TYPEINFO_DEBUG_TEST*/
79 #define TYPECHECK_VERBOSE
80 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
81 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
82 #define TYPECHECK_VERBOSE_OPT
87 /* additional data types ******************************************************/
89 typedef void *voidptr; /* generic pointer */
91 typedef int bool; /* boolean data type */
97 /* immediate data union */
109 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
111 /* CAUTION: Don't change the numerical values! These constants are
112 * used as indices into the primitive type table.
114 #define PRIMITIVETYPE_INT 0
115 #define PRIMITIVETYPE_LONG 1
116 #define PRIMITIVETYPE_FLOAT 2
117 #define PRIMITIVETYPE_DOUBLE 3
118 #define PRIMITIVETYPE_BYTE 4
119 #define PRIMITIVETYPE_CHAR 5
120 #define PRIMITIVETYPE_SHORT 6
121 #define PRIMITIVETYPE_BOOLEAN 7
122 #define PRIMITIVETYPE_VOID 8
124 typedef void (*functionptr) (); /* generic function pointer */
127 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
129 /* shutdown function **********************************************************/
131 void cacao_shutdown(s4 status);
134 /* basic data types ***********************************************************/
136 /* CAUTION: jit/jit.h relies on these numerical values! */
137 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
138 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
139 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
140 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
141 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
146 /* Java class file constants **************************************************/
148 #define MAGIC 0xcafebabe
149 #define MINOR_VERSION 3
150 #define MAJOR_VERSION 45
152 #define CONSTANT_Class 7
153 #define CONSTANT_Fieldref 9
154 #define CONSTANT_Methodref 10
155 #define CONSTANT_InterfaceMethodref 11
156 #define CONSTANT_String 8
157 #define CONSTANT_Integer 3
158 #define CONSTANT_Float 4
159 #define CONSTANT_Long 5
160 #define CONSTANT_Double 6
161 #define CONSTANT_NameAndType 12
162 #define CONSTANT_Utf8 1
164 #define CONSTANT_UNUSED 0
166 #define ACC_PUBLIC 0x0001
167 #define ACC_PRIVATE 0x0002
168 #define ACC_PROTECTED 0x0004
169 #define ACC_STATIC 0x0008
170 #define ACC_FINAL 0x0010
171 #define ACC_SUPER 0x0020
172 #define ACC_SYNCHRONIZED 0x0020
173 #define ACC_VOLATILE 0x0040
174 #define ACC_TRANSIENT 0x0080
175 #define ACC_NATIVE 0x0100
176 #define ACC_INTERFACE 0x0200
177 #define ACC_ABSTRACT 0x0400
178 #define ACC_STRICT 0x0800
180 /* resolve typedef cycles *****************************************************/
182 typedef struct utf utf;
183 typedef struct literalstring literalstring;
184 typedef struct java_objectheader java_objectheader;
185 typedef struct classinfo classinfo;
186 typedef struct vftbl vftbl;
187 typedef u1* methodptr;
188 typedef struct fieldinfo fieldinfo;
189 typedef struct methodinfo methodinfo;
190 typedef struct arraydescriptor arraydescriptor;
193 /* constant pool entries *******************************************************
195 All constant pool entries need a data structure which contain the entrys
196 value. In some cases this structure exist already, in the remaining cases
197 this structure must be generated:
199 kind structure generated?
200 ----------------------------------------------------------------------
201 CONSTANT_Class classinfo no
202 CONSTANT_Fieldref constant_FMIref yes
203 CONSTANT_Methodref constant_FMIref yes
204 CONSTANT_InterfaceMethodref constant_FMIref yes
205 CONSTANT_String unicode no
206 CONSTANT_Integer constant_integer yes
207 CONSTANT_Float constant_float yes
208 CONSTANT_Long constant_long yes
209 CONSTANT_Double constant_double yes
210 CONSTANT_NameAndType constant_nameandtype yes
211 CONSTANT_Utf8 unicode no
214 *******************************************************************************/
216 /* data structures for hashtables ********************************************
219 All utf-symbols, javastrings and classes are stored in global hashtables,
220 so every symbol exists only once. Equal symbols have identical pointers.
221 The functions for adding hashtable elements search the table for the
222 element with the specified name/text and return it on success. Otherwise a
223 new hashtable element is created.
225 The hashtables use external linking for handling collisions. The hashtable
226 structure contains a pointer <ptr> to the array of hashtable slots. The
227 number of hashtable slots and therefore the size of this array is specified
228 by the element <size> of hashtable structure. <entries> contains the number
229 of all hashtable elements stored in the table, including those in the
231 The hashtable element structures (utf, literalstring, classinfo) contain
232 both a pointer to the next hashtable element as a link for the external hash
233 chain and the key of the element. The key is computed from the text of
234 the string or the classname by using up to 8 characters.
236 If the number of entries in the hashtable exceeds twice the size of the
237 hashtableslot-array it is supposed that the average length of the
238 external chains has reached a value beyond 2. Therefore the functions for
239 adding hashtable elements (utf_new, class_new, literalstring_new) double
240 the hashtableslot-array. In this restructuring process all elements have
241 to be inserted into the new hashtable and new external chains must be built.
244 example for the layout of a hashtable:
246 hashtable.ptr--> +-------------------+
250 +-------------------+ +-------------------+ +-------------------+
251 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
252 +-------------------+ +-------------------+ +-------------------+
253 | hashtable element |
254 +-------------------+ +-------------------+
255 | hashtable element |-->| hashtable element |-->NULL
256 +-------------------+ +-------------------+
257 | hashtable element |-->NULL
258 +-------------------+
262 +-------------------+
267 /* data structure for utf8 symbols ********************************************/
270 utf *hashlink; /* link for external hash chain */
271 int blength; /* text length in bytes */
272 char *text; /* pointer to text */
276 /* data structure of internal javastrings stored in global hashtable **********/
278 struct literalstring {
279 literalstring *hashlink; /* link for external hash chain */
280 java_objectheader *string;
284 /* data structure for calls from c code to java methods */
286 struct jni_callblock {
291 typedef struct jni_callblock jni_callblock;
294 /* data structure for accessing hashtables ************************************/
298 u4 entries; /* number of entries in the table */
299 void **ptr; /* pointer to hashtable */
303 /* data structures of remaining constant pool entries *************************/
305 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
306 classinfo *class; /* class containing this field/method/interface */
307 utf *name; /* field/method/interface name */
308 utf *descriptor; /* field/method/interface type descriptor string */
312 typedef struct { /* Integer */
317 typedef struct { /* Float */
322 typedef struct { /* Long */
327 typedef struct { /* Double */
332 typedef struct { /* NameAndType (Field or Method) */
333 utf *name; /* field/method name */
334 utf *descriptor; /* field/method type descriptor string */
335 } constant_nameandtype;
338 /* data structures of the runtime system **************************************/
340 /* objects *********************************************************************
342 All objects (and arrays) which resides on the heap need the following
343 header at the beginning of the data structure.
346 struct java_objectheader { /* header for all objects */
347 vftbl *vftbl; /* pointer to virtual function table */
352 /* arrays **********************************************************************
354 All arrays are objects (they need the object header with a pointer
355 to a vftbl (array class table). There is one class for each array
356 type. The array type is described by an arraydescriptor struct
357 which is referenced by the vftbl.
360 /* CAUTION: Don't change the numerical values! These constants (with
361 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
362 * primitive type table.
364 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
365 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
366 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
367 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
368 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
369 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
370 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
371 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
372 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
374 typedef struct java_arrayheader { /* header for all arrays */
375 java_objectheader objheader; /* object header */
376 s4 size; /* array size */
377 #ifdef SIZE_FROM_CLASSINFO
378 s4 alignedsize; /* phil */
384 /* structs for all kinds of arrays ********************************************/
386 typedef struct java_chararray {
387 java_arrayheader header;
391 typedef struct java_floatheader {
392 java_arrayheader header;
396 typedef struct java_doublearray {
397 java_arrayheader header;
401 /* booleanarray and bytearray need identical memory layout (access methods
402 use the same machine code */
404 typedef struct java_booleanarray {
405 java_arrayheader header;
409 typedef struct java_bytearray {
410 java_arrayheader header;
414 typedef struct java_shortarray {
415 java_arrayheader header;
419 typedef struct java_intarray {
420 java_arrayheader header;
424 typedef struct java_longarray {
425 java_arrayheader header;
429 /* objectarray and arrayarray need identical memory layout (access methods
430 use the same machine code */
432 typedef struct java_objectarray {
433 java_arrayheader header;
434 java_objectheader *data[1];
438 /* structure for primitive classes ********************************************/
440 typedef struct primitivetypeinfo {
441 classinfo *class_wrap; /* class for wrapping primitive type */
442 classinfo *class_primitive; /* primitive class */
443 char *wrapname; /* name of class for wrapping */
444 char typesig; /* one character type signature */
445 char *name; /* name of primitive class */
446 char *arrayname; /* name of primitive array class */
447 classinfo *arrayclass; /* primitive array class */
448 vftbl *arrayvftbl; /* vftbl of primitive array class */
452 /* field, method and class structures *****************************************/
455 typedef struct xtafldinfo {
457 classinfo *fldClassType;
458 classSet *XTAclassSet; /* field class type set */
462 /* fieldinfo ******************************************************************/
464 struct fieldinfo { /* field of a class */
465 s4 flags; /* ACC flags */
466 s4 type; /* basic data type */
467 utf *name; /* name of field */
468 utf *descriptor; /* JavaVM descriptor string of field */
470 s4 offset; /* offset from start of object (instance variables) */
472 imm_union value; /* storage for static values (class variables) */
474 classinfo *class; /* XXX needed by typechecker. Could be optimized */
475 /* away by using constant_FMIref instead of */
476 /* fieldinfo throughout the compiler. */
484 /* exceptiontable *************************************************************/
486 typedef struct xtable { /* exceptiontable entry in a method */
487 s4 startpc; /* start pc of guarded area (inclusive) */
488 struct basicblock *start;
490 s4 endpc; /* end pc of guarded area (exklusive) */
491 struct basicblock *end;
493 s4 handlerpc; /* pc of exception handler */
494 struct basicblock *handler;
496 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
497 struct xtable *next; /* used to build a list of exception when */
498 /* loops are copied */
499 struct xtable *down; /* instead of the old array, a list is used */
503 typedef struct exceptiontable { /* exceptiontable entry in a method */
504 s4 startpc; /* start pc of guarded area (inclusive) */
505 s4 endpc; /* end pc of guarded area (exklusive) */
506 s4 handlerpc; /* pc of exception handler */
507 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
511 /* methodinfo static info ****************************************************/
512 typedef struct xtainfo {
513 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
514 classSet *XTAclassSet; /* method class type set */
515 /*classSet *PartClassSet */ /* method class type set */
517 classSetNode *paramClassSet; /* cone set of methods parameters */
519 methSet *calls; /* methods this method calls */
520 methSet *calledBy; /* methods that call this method */
521 methSet *marked; /* methods that marked by this method */
522 /*methSet *markedBy*/
523 fldSet *fldsUsed; /* fields used by this method */
524 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
525 bool chgdSinceLastParse; /* Changed since last parse ? */
529 /* methodinfo *****************************************************************/
531 struct methodinfo { /* method structure */
532 s4 flags; /* ACC flags */
533 utf *name; /* name of method */
534 utf *descriptor; /* JavaVM descriptor string of method */
535 s4 returntype; /* only temporary valid, return type */
536 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
537 s4 paramcount; /* only temporary valid, parameter count */
538 u1 *paramtypes; /* only temporary valid, parameter types */
539 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
541 classinfo *class; /* class, the method belongs to */
542 s4 vftblindex; /* index of method in virtual function table
543 (if it is a virtual method) */
544 s4 maxstack; /* maximum stack depth of method */
545 s4 maxlocals; /* maximum number of local variables */
546 s4 jcodelength; /* length of JavaVM code */
547 u1 *jcode; /* pointer to JavaVM code */
549 s4 exceptiontablelength;/* exceptiontable length */
550 exceptiontable *exceptiontable;
551 /* the exceptiontable */
553 u1 *stubroutine; /* stub for compiling or calling natives */
554 s4 mcodelength; /* legth of generated machine code */
555 u1 *mcode; /* pointer to machine code */
556 u1 *entrypoint; /* entry point in machine code */
561 s4 methodUsed; /* marked (might be used later) /not used /used */
562 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
563 /* should # method def'd and used be kept after static parse (will it be used?) */
569 /* innerclassinfo *************************************************************/
571 typedef struct innerclassinfo {
572 classinfo *inner_class; /* inner class pointer */
573 classinfo *outer_class; /* outer class pointer */
574 utf *name; /* innerclass name */
575 s4 flags; /* ACC flags */
579 /* classinfo ******************************************************************/
581 struct classinfo { /* class structure */
582 java_objectheader header; /* classes are also objects */
583 java_objectarray* signers;
584 struct java_security_ProtectionDomain* pd;
585 struct java_lang_VMClass* vmClass;
586 struct java_lang_reflect_Constructor* constructor;
589 s4 initializing_thread; /* gnu classpath */
590 s4 erroneous_state; /* gnu classpath */
591 struct gnu_classpath_RawData* vmData; /* gnu classpath */
593 s4 flags; /* ACC flags */
594 utf *name; /* class name */
596 s4 cpcount; /* number of entries in constant pool */
597 u1 *cptags; /* constant pool tags */
598 voidptr *cpinfos; /* pointer to constant pool info structures */
600 classinfo *super; /* super class pointer */
601 classinfo *sub; /* sub class pointer */
602 classinfo *nextsub; /* pointer to next class in sub class list */
604 s4 interfacescount; /* number of interfaces */
605 classinfo **interfaces; /* pointer to interfaces */
607 s4 fieldscount; /* number of fields */
608 fieldinfo *fields; /* field table */
610 s4 methodscount; /* number of methods */
611 methodinfo *methods; /* method table */
613 listnode listnode; /* linkage */
615 bool initialized; /* true, if class already initialised */
616 bool loaded; /* true, if class already loaded */
617 bool linked; /* true, if class already linked */
618 s4 index; /* hierarchy depth (classes) or index
620 s4 instancesize; /* size of an instance of this class */
621 #ifdef SIZE_FROM_CLASSINFO
622 s4 alignedsize; /* size of an instance, aligned to the
623 allocation size on the heap */
626 vftbl *vftbl; /* pointer to virtual function table */
628 methodinfo *finalizer; /* finalizer method */
630 u2 innerclasscount; /* number of inner classes */
631 innerclassinfo *innerclass;
633 classinfo *hashlink; /* link for external hash chain */
634 bool classvftbl; /* has its own copy of the Class vtbl */
636 s4 classUsed; /* 0= not used 1 = used CO-RT */
638 classSetNode *impldBy; /* implemented by class set */
641 /* check if class is an array class. Only use for linked classes! */
642 #define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
645 /* virtual function table ******************************************************
647 The vtbl has a bidirectional layout with open ends at both sides.
648 interfacetablelength gives the number of entries of the interface table at
649 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
650 vftbllength gives the number of entries of table at the end of the vftbl.
652 runtime type check (checkcast):
654 Different methods are used for runtime type check depending on the
655 argument of checkcast/instanceof.
657 A check against a class is implemented via relative numbering on the class
658 hierachy tree. The tree is numbered in a depth first traversal setting
659 the base field and the diff field. The diff field gets the result of
660 (high - base) so that a range check can be implemented by an unsigned
661 compare. A sub type test is done by checking the inclusion of base of
662 the sub class in the range of the superclass.
664 A check against an interface is implemented via the interfacevftbl. If the
665 interfacevftbl contains a nonnull value a class is a subclass of this
670 Like standard virtual methods interface methods are called using
671 virtual function tables. All interfaces are numbered sequentially
672 (starting with zero). For each class there exist an interface table
673 of virtual function tables for each implemented interface. The length
674 of the interface table is determined by the highest number of an
675 implemented interface.
677 The following example assumes a class which implements interface 0 and 3:
679 interfacetablelength = 4
682 +-----------+ | method 2 |---> method z
683 | class | | method 1 |---> method y
684 +-----------+ | method 0 |---> method x
685 | ivftbl 0 |----------> +----------+
686 vftblptr ---> +-----------+
687 | ivftbl -1 |--> NULL +----------+
688 | ivftbl -2 |--> NULL | method 1 |---> method x
689 | ivftbl -3 |-----+ | method 0 |---> method a
690 +-----------+ +----> +----------+
697 interfacevftbllength ---> +---------------+
699 *******************************************************************************/
702 methodptr *interfacetable[1]; /* interface table (access via macro) */
704 classinfo *class; /* class, the vtbl belongs to */
706 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
708 s4 vftbllength; /* virtual function table length */
709 s4 interfacetablelength; /* interface table length */
711 s4 baseval; /* base for runtime type check */
712 /* (-index for interfaces) */
713 s4 diffval; /* high - base for runtime type check */
715 s4 *interfacevftbllength; /* length of interface vftbls */
717 methodptr table[1]; /* class vftbl */
720 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
723 /* arraydescriptor ************************************************************
725 For every array class an arraydescriptor is allocated which
726 describes the array class.
727 The arraydescriptor is referenced from the vftbl of the array
730 *******************************************************************************/
732 struct arraydescriptor {
733 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
734 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
735 short arraytype; /* ARRAYTYPE_* constant */
736 short dimension; /* dimension of the array (always >= 1) */
737 s4 dataoffset; /* offset of the array data from object pointer */
738 s4 componentsize; /* size of a component in bytes */
739 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
743 /* references to some system classes ******************************************/
745 extern classinfo *class_java_lang_Object;
746 extern classinfo *class_java_lang_String;
747 extern classinfo *class_java_lang_Throwable;
748 extern classinfo *class_java_lang_Cloneable;
749 extern classinfo *class_java_io_Serializable;
750 extern classinfo *class_java_lang_ClassCastException;
751 extern classinfo *class_java_lang_NullPointerException;
752 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
753 extern classinfo *class_java_lang_NegativeArraySizeException;
754 extern classinfo *class_java_lang_OutOfMemoryError;
755 extern classinfo *class_java_lang_ArithmeticException;
756 extern classinfo *class_java_lang_ArrayStoreException;
757 extern classinfo *class_java_lang_ThreadDeath;
758 extern classinfo *pseudo_class_Arraystub;
759 extern classinfo *pseudo_class_Null;
760 extern classinfo *pseudo_class_New;
761 extern vftbl *pseudo_class_Arraystub_vftbl;
764 /* instances of some system classes *******************************************/
766 extern java_objectheader *proto_java_lang_ClassCastException;
767 extern java_objectheader *proto_java_lang_NullPointerException;
768 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
769 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
770 extern java_objectheader *proto_java_lang_OutOfMemoryError;
771 extern java_objectheader *proto_java_lang_ArithmeticException;
772 extern java_objectheader *proto_java_lang_ArrayStoreException;
773 extern java_objectheader *proto_java_lang_ThreadDeath;
776 /* flag variables *************************************************************/
778 extern bool compileall;
779 extern bool runverbose;
781 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
782 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
783 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
784 extern bool opt_verify; /* true if classfiles should be verified */
785 #ifdef TYPECHECK_VERBOSE_OPT
786 extern bool typecheckverbose;
789 /*extern int pClassHeir;*/
790 /*extern int pCallgraph;*/
791 /*extern int pOpcodes;*/
792 /*extern int pStats;*/
794 /*extern void RT_jit_parse(methodinfo *m);*/
797 /* statistic variables ********************************************************/
799 extern int count_class_infos;
800 extern int count_const_pool_len;
801 extern int count_vftbl_len;
802 extern int count_utf_len;
803 extern int count_all_methods;
804 extern int count_vmcode_len;
805 extern int count_extable_len;
806 extern int count_class_loads;
807 extern int count_class_inits;
808 extern int count_utf_new;
809 extern int count_utf_new_found;
812 /* table of primitive types ***************************************************/
814 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
815 * constants (except ARRAYTYPE_OBJECT).
817 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
820 /* macros for descriptor parsing **********************************************/
822 /* SKIP_FIELDDESCRIPTOR:
823 * utf_ptr must point to the first character of a field descriptor.
824 * After the macro call utf_ptr points to the first character after
825 * the field descriptor.
827 * CAUTION: This macro does not check for an unexpected end of the
828 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
830 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
831 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
832 if (*(utf_ptr)++=='L') \
833 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
835 /* SKIP_FIELDDESCRIPTOR_SAFE:
836 * utf_ptr must point to the first character of a field descriptor.
837 * After the macro call utf_ptr points to the first character after
838 * the field descriptor.
841 * utf_ptr....points to first char of descriptor
842 * end_ptr....points to first char after the end of the string
843 * errorflag..must be initialized (to false) by the caller!
845 * utf_ptr....points to first char after the descriptor
846 * errorflag..set to true if the string ended unexpectedly
848 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
849 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
850 if ((utf_ptr) == (end_ptr)) \
851 (errorflag) = true; \
853 if (*(utf_ptr)++=='L') { \
854 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
856 if ((utf_ptr)[-1] != ';') \
857 (errorflag) = true; }} while(0)
860 /* Synchronization ************************************************************/
862 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
863 extern pthread_mutex_t compiler_mutex;
864 extern int cast_counter;
870 #endif /* _GLOBAL_H */
874 * These are local overrides for various environment variables in Emacs.
875 * Please do not remove this and leave it at the end of the file, where
876 * Emacs will automagically detect them.
877 * ---------------------------------------------------------------------
880 * indent-tabs-mode: t