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 741 2003-12-13 20:07:41Z stefan $
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_SYNCHRONIZED 0x0020
172 #define ACC_VOLATILE 0x0040
173 #define ACC_TRANSIENT 0x0080
174 #define ACC_NATIVE 0x0100
175 #define ACC_INTERFACE 0x0200
176 #define ACC_ABSTRACT 0x0400
177 #define ACC_STRICT 0x0800
179 /* resolve typedef cycles *****************************************************/
181 typedef struct utf utf;
182 typedef struct literalstring literalstring;
183 typedef struct java_objectheader java_objectheader;
184 typedef struct classinfo classinfo;
185 typedef struct vftbl vftbl;
186 typedef u1* methodptr;
187 typedef struct fieldinfo fieldinfo;
188 typedef struct methodinfo methodinfo;
189 typedef struct arraydescriptor arraydescriptor;
192 /* constant pool entries *******************************************************
194 All constant pool entries need a data structure which contain the entrys
195 value. In some cases this structure exist already, in the remaining cases
196 this structure must be generated:
198 kind structure generated?
199 ----------------------------------------------------------------------
200 CONSTANT_Class classinfo no
201 CONSTANT_Fieldref constant_FMIref yes
202 CONSTANT_Methodref constant_FMIref yes
203 CONSTANT_InterfaceMethodref constant_FMIref yes
204 CONSTANT_String unicode no
205 CONSTANT_Integer constant_integer yes
206 CONSTANT_Float constant_float yes
207 CONSTANT_Long constant_long yes
208 CONSTANT_Double constant_double yes
209 CONSTANT_NameAndType constant_nameandtype yes
210 CONSTANT_Utf8 unicode no
213 *******************************************************************************/
215 /* data structures for hashtables ********************************************
218 All utf-symbols, javastrings and classes are stored in global hashtables,
219 so every symbol exists only once. Equal symbols have identical pointers.
220 The functions for adding hashtable elements search the table for the
221 element with the specified name/text and return it on success. Otherwise a
222 new hashtable element is created.
224 The hashtables use external linking for handling collisions. The hashtable
225 structure contains a pointer <ptr> to the array of hashtable slots. The
226 number of hashtable slots and therefore the size of this array is specified
227 by the element <size> of hashtable structure. <entries> contains the number
228 of all hashtable elements stored in the table, including those in the
230 The hashtable element structures (utf, literalstring, classinfo) contain
231 both a pointer to the next hashtable element as a link for the external hash
232 chain and the key of the element. The key is computed from the text of
233 the string or the classname by using up to 8 characters.
235 If the number of entries in the hashtable exceeds twice the size of the
236 hashtableslot-array it is supposed that the average length of the
237 external chains has reached a value beyond 2. Therefore the functions for
238 adding hashtable elements (utf_new, class_new, literalstring_new) double
239 the hashtableslot-array. In this restructuring process all elements have
240 to be inserted into the new hashtable and new external chains must be built.
243 example for the layout of a hashtable:
245 hashtable.ptr--> +-------------------+
249 +-------------------+ +-------------------+ +-------------------+
250 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
251 +-------------------+ +-------------------+ +-------------------+
252 | hashtable element |
253 +-------------------+ +-------------------+
254 | hashtable element |-->| hashtable element |-->NULL
255 +-------------------+ +-------------------+
256 | hashtable element |-->NULL
257 +-------------------+
261 +-------------------+
266 /* data structure for utf8 symbols ********************************************/
269 utf *hashlink; /* link for external hash chain */
270 int blength; /* text length in bytes */
271 char *text; /* pointer to text */
275 /* data structure of internal javastrings stored in global hashtable **********/
277 struct literalstring {
278 literalstring *hashlink; /* link for external hash chain */
279 java_objectheader *string;
283 /* data structure for calls from c code to java methods */
285 struct jni_callblock {
290 typedef struct jni_callblock jni_callblock;
293 /* data structure for accessing hashtables ************************************/
297 u4 entries; /* number of entries in the table */
298 void **ptr; /* pointer to hashtable */
302 /* data structures of remaining constant pool entries *************************/
304 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
305 classinfo *class; /* class containing this field/method/interface */
306 utf *name; /* field/method/interface name */
307 utf *descriptor; /* field/method/interface type descriptor string */
311 typedef struct { /* Integer */
316 typedef struct { /* Float */
321 typedef struct { /* Long */
326 typedef struct { /* Double */
331 typedef struct { /* NameAndType (Field or Method) */
332 utf *name; /* field/method name */
333 utf *descriptor; /* field/method type descriptor string */
334 } constant_nameandtype;
337 /* data structures of the runtime system **************************************/
339 /* objects *********************************************************************
341 All objects (and arrays) which resides on the heap need the following
342 header at the beginning of the data structure.
345 struct java_objectheader { /* header for all objects */
346 vftbl *vftbl; /* pointer to virtual function table */
351 /* arrays **********************************************************************
353 All arrays are objects (they need the object header with a pointer
354 to a vftbl (array class table). There is one class for each array
355 type. The array type is described by an arraydescriptor struct
356 which is referenced by the vftbl.
359 /* CAUTION: Don't change the numerical values! These constants (with
360 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
361 * primitive type table.
363 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
364 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
365 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
366 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
367 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
368 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
369 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
370 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
371 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
373 typedef struct java_arrayheader { /* header for all arrays */
374 java_objectheader objheader; /* object header */
375 s4 size; /* array size */
376 #ifdef SIZE_FROM_CLASSINFO
377 s4 alignedsize; /* phil */
383 /* structs for all kinds of arrays ********************************************/
385 typedef struct java_chararray {
386 java_arrayheader header;
390 typedef struct java_floatheader {
391 java_arrayheader header;
395 typedef struct java_doublearray {
396 java_arrayheader header;
400 /* booleanarray and bytearray need identical memory layout (access methods
401 use the same machine code */
403 typedef struct java_booleanarray {
404 java_arrayheader header;
408 typedef struct java_bytearray {
409 java_arrayheader header;
413 typedef struct java_shortarray {
414 java_arrayheader header;
418 typedef struct java_intarray {
419 java_arrayheader header;
423 typedef struct java_longarray {
424 java_arrayheader header;
428 /* objectarray and arrayarray need identical memory layout (access methods
429 use the same machine code */
431 typedef struct java_objectarray {
432 java_arrayheader header;
433 java_objectheader *data[1];
437 /* structure for primitive classes ********************************************/
439 typedef struct primitivetypeinfo {
440 classinfo *class_wrap; /* class for wrapping primitive type */
441 classinfo *class_primitive; /* primitive class */
442 char *wrapname; /* name of class for wrapping */
443 char typesig; /* one character type signature */
444 char *name; /* name of primitive class */
445 char *arrayname; /* name of primitive array class */
446 classinfo *arrayclass; /* primitive array class */
447 vftbl *arrayvftbl; /* vftbl of primitive array class */
451 /* field, method and class structures *****************************************/
454 typedef struct xtafldinfo {
456 classinfo *fldClassType;
457 classSet *XTAclassSet; /* field class type set */
461 /* fieldinfo ******************************************************************/
463 struct fieldinfo { /* field of a class */
464 s4 flags; /* ACC flags */
465 s4 type; /* basic data type */
466 utf *name; /* name of field */
467 utf *descriptor; /* JavaVM descriptor string of field */
469 s4 offset; /* offset from start of object (instance variables) */
471 imm_union value; /* storage for static values (class variables) */
473 classinfo *class; /* XXX needed by typechecker. Could be optimized */
474 /* away by using constant_FMIref instead of */
475 /* fieldinfo throughout the compiler. */
483 /* exceptiontable *************************************************************/
485 typedef struct xtable { /* exceptiontable entry in a method */
486 s4 startpc; /* start pc of guarded area (inclusive) */
487 struct basicblock *start;
489 s4 endpc; /* end pc of guarded area (exklusive) */
490 struct basicblock *end;
492 s4 handlerpc; /* pc of exception handler */
493 struct basicblock *handler;
495 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
496 struct xtable *next; /* used to build a list of exception when */
497 /* loops are copied */
498 struct xtable *down; /* instead of the old array, a list is used */
502 typedef struct exceptiontable { /* exceptiontable entry in a method */
503 s4 startpc; /* start pc of guarded area (inclusive) */
504 s4 endpc; /* end pc of guarded area (exklusive) */
505 s4 handlerpc; /* pc of exception handler */
506 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
510 /* methodinfo static info ****************************************************/
511 typedef struct xtainfo {
512 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
513 classSet *XTAclassSet; /* method class type set */
514 /*classSet *PartClassSet */ /* method class type set */
516 classSetNode *paramClassSet; /* cone set of methods parameters */
518 methSet *calls; /* methods this method calls */
519 methSet *calledBy; /* methods that call this method */
520 methSet *marked; /* methods that marked by this method */
521 /*methSet *markedBy*/
522 fldSet *fldsUsed; /* fields used by this method */
523 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
524 bool chgdSinceLastParse; /* Changed since last parse ? */
528 /* methodinfo *****************************************************************/
530 struct methodinfo { /* method structure */
531 s4 flags; /* ACC flags */
532 utf *name; /* name of method */
533 utf *descriptor; /* JavaVM descriptor string of method */
534 s4 returntype; /* only temporary valid, return type */
535 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
536 s4 paramcount; /* only temporary valid, parameter count */
537 u1 *paramtypes; /* only temporary valid, parameter types */
538 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
540 classinfo *class; /* class, the method belongs to */
541 s4 vftblindex; /* index of method in virtual function table
542 (if it is a virtual method) */
543 s4 maxstack; /* maximum stack depth of method */
544 s4 maxlocals; /* maximum number of local variables */
545 s4 jcodelength; /* length of JavaVM code */
546 u1 *jcode; /* pointer to JavaVM code */
548 s4 exceptiontablelength;/* exceptiontable length */
549 exceptiontable *exceptiontable;
550 /* the exceptiontable */
552 u1 *stubroutine; /* stub for compiling or calling natives */
553 s4 mcodelength; /* legth of generated machine code */
554 u1 *mcode; /* pointer to machine code */
555 u1 *entrypoint; /* entry point in machine code */
560 s4 methodUsed; /* marked (might be used later) /not used /used */
561 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
562 /* should # method def'd and used be kept after static parse (will it be used?) */
568 /* innerclassinfo *************************************************************/
570 typedef struct innerclassinfo {
571 classinfo *inner_class; /* inner class pointer */
572 classinfo *outer_class; /* outer class pointer */
573 utf *name; /* innerclass name */
574 s4 flags; /* ACC flags */
578 /* classinfo ******************************************************************/
580 struct classinfo { /* class structure */
581 java_objectheader header; /* classes are also objects */
582 java_objectarray* signers;
583 struct java_security_ProtectionDomain* pd;
584 struct java_lang_VMClass* vmClass;
585 struct java_lang_reflect_Constructor* constructor;
588 s4 initializing_thread; /* gnu classpath */
589 s4 erroneous_state; /* gnu classpath */
590 struct gnu_classpath_RawData* vmData; /* gnu classpath */
592 s4 flags; /* ACC flags */
593 utf *name; /* class name */
595 s4 cpcount; /* number of entries in constant pool */
596 u1 *cptags; /* constant pool tags */
597 voidptr *cpinfos; /* pointer to constant pool info structures */
599 classinfo *super; /* super class pointer */
600 classinfo *sub; /* sub class pointer */
601 classinfo *nextsub; /* pointer to next class in sub class list */
603 s4 interfacescount; /* number of interfaces */
604 classinfo **interfaces; /* pointer to interfaces */
606 s4 fieldscount; /* number of fields */
607 fieldinfo *fields; /* field table */
609 s4 methodscount; /* number of methods */
610 methodinfo *methods; /* method table */
612 listnode listnode; /* linkage */
614 bool initialized; /* true, if class already initialised */
615 bool loaded; /* true, if class already loaded */
616 bool linked; /* true, if class already linked */
617 s4 index; /* hierarchy depth (classes) or index
619 s4 instancesize; /* size of an instance of this class */
620 #ifdef SIZE_FROM_CLASSINFO
621 s4 alignedsize; /* size of an instance, aligned to the
622 allocation size on the heap */
625 vftbl *vftbl; /* pointer to virtual function table */
627 methodinfo *finalizer; /* finalizer method */
629 u2 innerclasscount; /* number of inner classes */
630 innerclassinfo *innerclass;
632 classinfo *hashlink; /* link for external hash chain */
633 bool classvftbl; /* has its own copy of the Class vtbl */
635 s4 classUsed; /* 0= not used 1 = used CO-RT */
637 classSetNode *impldBy; /* implemented by class set */
640 /* check if class is an array class. Only use for linked classes! */
641 #define CLASS_IS_ARRAY(clsinfo) (clsinfo->vftbl->arraydesc != NULL)
644 /* virtual function table ******************************************************
646 The vtbl has a bidirectional layout with open ends at both sides.
647 interfacetablelength gives the number of entries of the interface table at
648 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
649 vftbllength gives the number of entries of table at the end of the vftbl.
651 runtime type check (checkcast):
653 Different methods are used for runtime type check depending on the
654 argument of checkcast/instanceof.
656 A check against a class is implemented via relative numbering on the class
657 hierachy tree. The tree is numbered in a depth first traversal setting
658 the base field and the diff field. The diff field gets the result of
659 (high - base) so that a range check can be implemented by an unsigned
660 compare. A sub type test is done by checking the inclusion of base of
661 the sub class in the range of the superclass.
663 A check against an interface is implemented via the interfacevftbl. If the
664 interfacevftbl contains a nonnull value a class is a subclass of this
669 Like standard virtual methods interface methods are called using
670 virtual function tables. All interfaces are numbered sequentially
671 (starting with zero). For each class there exist an interface table
672 of virtual function tables for each implemented interface. The length
673 of the interface table is determined by the highest number of an
674 implemented interface.
676 The following example assumes a class which implements interface 0 and 3:
678 interfacetablelength = 4
681 +-----------+ | method 2 |---> method z
682 | class | | method 1 |---> method y
683 +-----------+ | method 0 |---> method x
684 | ivftbl 0 |----------> +----------+
685 vftblptr ---> +-----------+
686 | ivftbl -1 |--> NULL +----------+
687 | ivftbl -2 |--> NULL | method 1 |---> method x
688 | ivftbl -3 |-----+ | method 0 |---> method a
689 +-----------+ +----> +----------+
696 interfacevftbllength ---> +---------------+
698 *******************************************************************************/
701 methodptr *interfacetable[1]; /* interface table (access via macro) */
703 classinfo *class; /* class, the vtbl belongs to */
705 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
707 s4 vftbllength; /* virtual function table length */
708 s4 interfacetablelength; /* interface table length */
710 s4 baseval; /* base for runtime type check */
711 /* (-index for interfaces) */
712 s4 diffval; /* high - base for runtime type check */
714 s4 *interfacevftbllength; /* length of interface vftbls */
716 methodptr table[1]; /* class vftbl */
719 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
722 /* arraydescriptor ************************************************************
724 For every array class an arraydescriptor is allocated which
725 describes the array class.
726 The arraydescriptor is referenced from the vftbl of the array
729 *******************************************************************************/
731 struct arraydescriptor {
732 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
733 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
734 short arraytype; /* ARRAYTYPE_* constant */
735 short dimension; /* dimension of the array (always >= 1) */
736 s4 dataoffset; /* offset of the array data from object pointer */
737 s4 componentsize; /* size of a component in bytes */
738 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
742 /* references to some system classes ******************************************/
744 extern classinfo *class_java_lang_Object;
745 extern classinfo *class_java_lang_String;
746 extern classinfo *class_java_lang_Throwable;
747 extern classinfo *class_java_lang_Cloneable;
748 extern classinfo *class_java_io_Serializable;
749 extern classinfo *class_java_lang_ClassCastException;
750 extern classinfo *class_java_lang_NullPointerException;
751 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
752 extern classinfo *class_java_lang_NegativeArraySizeException;
753 extern classinfo *class_java_lang_OutOfMemoryError;
754 extern classinfo *class_java_lang_ArithmeticException;
755 extern classinfo *class_java_lang_ArrayStoreException;
756 extern classinfo *class_java_lang_ThreadDeath;
757 extern classinfo *pseudo_class_Arraystub;
758 extern classinfo *pseudo_class_Null;
759 extern classinfo *pseudo_class_New;
760 extern vftbl *pseudo_class_Arraystub_vftbl;
763 /* instances of some system classes *******************************************/
765 extern java_objectheader *proto_java_lang_ClassCastException;
766 extern java_objectheader *proto_java_lang_NullPointerException;
767 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
768 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
769 extern java_objectheader *proto_java_lang_OutOfMemoryError;
770 extern java_objectheader *proto_java_lang_ArithmeticException;
771 extern java_objectheader *proto_java_lang_ArrayStoreException;
772 extern java_objectheader *proto_java_lang_ThreadDeath;
775 /* flag variables *************************************************************/
777 extern bool compileall;
778 extern bool runverbose;
780 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
781 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
782 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
783 #ifdef TYPECHECK_VERBOSE_OPT
784 extern bool typecheckverbose;
787 //extern int pClassHeir;
788 //extern int pCallgraph;
789 //extern int pOpcodes;
792 //extern void RT_jit_parse(methodinfo *m);
795 /* statistic variables ********************************************************/
797 extern int count_class_infos;
798 extern int count_const_pool_len;
799 extern int count_vftbl_len;
800 extern int count_utf_len;
801 extern int count_all_methods;
802 extern int count_vmcode_len;
803 extern int count_extable_len;
804 extern int count_class_loads;
805 extern int count_class_inits;
806 extern int count_utf_new;
807 extern int count_utf_new_found;
810 /* table of primitive types ***************************************************/
812 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
813 * constants (except ARRAYTYPE_OBJECT).
815 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
818 /* macros for descriptor parsing **********************************************/
820 /* SKIP_FIELDDESCRIPTOR:
821 * utf_ptr must point to the first character of a field descriptor.
822 * After the macro call utf_ptr points to the first character after
823 * the field descriptor.
825 * CAUTION: This macro does not check for an unexpected end of the
826 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
828 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
829 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
830 if (*(utf_ptr)++=='L') \
831 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
833 /* SKIP_FIELDDESCRIPTOR_SAFE:
834 * utf_ptr must point to the first character of a field descriptor.
835 * After the macro call utf_ptr points to the first character after
836 * the field descriptor.
839 * utf_ptr....points to first char of descriptor
840 * end_ptr....points to first char after the end of the string
841 * errorflag..must be initialized (to false) by the caller!
843 * utf_ptr....points to first char after the descriptor
844 * errorflag..set to true if the string ended unexpectedly
846 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
847 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
848 if ((utf_ptr) == (end_ptr)) \
849 (errorflag) = true; \
851 if (*(utf_ptr)++=='L') { \
852 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
854 if ((utf_ptr)[-1] != ';') \
855 (errorflag) = true; }} while(0)
858 /* Synchronization ************************************************************/
860 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
861 extern pthread_mutex_t compiler_mutex;
862 extern int cast_counter;
868 #endif /* _GLOBAL_H */
872 * These are local overrides for various environment variables in Emacs.
873 * Please do not remove this and leave it at the end of the file, where
874 * Emacs will automagically detect them.
875 * ---------------------------------------------------------------------
878 * indent-tabs-mode: t