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 727 2003-12-11 10:52:40Z edwin $
44 #include "toolbox/list.h"
49 #define STATISTICS /* if enabled collects program statistics */
52 * SIZE_FROM_CLASSINFO toggles between the bitmap_based and the new method
53 * of determining the sizes of objects on the heap.
55 #define SIZE_FROM_CLASSINFO
58 * CACAO_TYPECHECK activates typechecking (part of bytecode verification)
60 #define CACAO_TYPECHECK
63 * Macros for configuration of the typechecking code
65 * TYPEINFO_DEBUG activates debug checks and debug helpers in typeinfo.c
66 * TYPECHECK_DEBUG activates debug checks in typecheck.c
67 * TYPEINFO_DEBUG_TEST activates the typeinfo test at startup.
68 * TYPECHECK_VERBOSE_IMPORTANT activates important debug messages
69 * TYPECHECK_VERBOSE activates all debug messages
71 #ifdef CACAO_TYPECHECK
72 #define TYPEINFO_DEBUG
73 #define TYPECHECK_DEBUG
74 /*#define TYPEINFO_DEBUG_TEST*/
75 #define TYPECHECK_VERBOSE
76 /*#define TYPECHECK_VERBOSE_IMPORTANT*/
77 #if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
78 #define TYPECHECK_VERBOSE_OPT
83 /* additional data types ******************************************************/
85 typedef void *voidptr; /* generic pointer */
87 typedef int bool; /* boolean data type */
93 /* immediate data union */
105 #define PRIMITIVETYPE_COUNT 9 /* number of primitive types */
107 /* CAUTION: Don't change the numerical values! These constants are
108 * used as indices into the primitive type table.
110 #define PRIMITIVETYPE_INT 0
111 #define PRIMITIVETYPE_LONG 1
112 #define PRIMITIVETYPE_FLOAT 2
113 #define PRIMITIVETYPE_DOUBLE 3
114 #define PRIMITIVETYPE_BYTE 4
115 #define PRIMITIVETYPE_CHAR 5
116 #define PRIMITIVETYPE_SHORT 6
117 #define PRIMITIVETYPE_BOOLEAN 7
118 #define PRIMITIVETYPE_VOID 8
120 typedef void (*functionptr) (); /* generic function pointer */
123 #define MAX_ALIGN 8 /* most generic alignment for JavaVM values */
125 /* shutdown function **********************************************************/
127 void cacao_shutdown(s4 status);
130 /* basic data types ***********************************************************/
132 /* CAUTION: jit/jit.h relies on these numerical values! */
133 #define TYPE_INT 0 /* the JavaVM types must numbered in the */
134 #define TYPE_LONG 1 /* same order as the ICMD_Ixxx to ICMD_Axxx */
135 #define TYPE_FLOAT 2 /* instructions (LOAD and STORE) */
136 #define TYPE_DOUBLE 3 /* integer, long, float, double, address */
137 #define TYPE_ADDRESS 4 /* all other types can be numbered arbitrarly */
142 /* Java class file constants **************************************************/
144 #define MAGIC 0xcafebabe
145 #define MINOR_VERSION 3
146 #define MAJOR_VERSION 45
148 #define CONSTANT_Class 7
149 #define CONSTANT_Fieldref 9
150 #define CONSTANT_Methodref 10
151 #define CONSTANT_InterfaceMethodref 11
152 #define CONSTANT_String 8
153 #define CONSTANT_Integer 3
154 #define CONSTANT_Float 4
155 #define CONSTANT_Long 5
156 #define CONSTANT_Double 6
157 #define CONSTANT_NameAndType 12
158 #define CONSTANT_Utf8 1
160 #define CONSTANT_UNUSED 0
162 #define ACC_PUBLIC 0x0001
163 #define ACC_PRIVATE 0x0002
164 #define ACC_PROTECTED 0x0004
165 #define ACC_STATIC 0x0008
166 #define ACC_FINAL 0x0010
167 #define ACC_SYNCHRONIZED 0x0020
168 #define ACC_VOLATILE 0x0040
169 #define ACC_TRANSIENT 0x0080
170 #define ACC_NATIVE 0x0100
171 #define ACC_INTERFACE 0x0200
172 #define ACC_ABSTRACT 0x0400
173 #define ACC_STRICT 0x0800
175 /* resolve typedef cycles *****************************************************/
177 typedef struct utf utf;
178 typedef struct literalstring literalstring;
179 typedef struct java_objectheader java_objectheader;
180 typedef struct classinfo classinfo;
181 typedef struct vftbl vftbl;
182 typedef u1* methodptr;
183 typedef struct fieldinfo fieldinfo;
184 typedef struct methodinfo methodinfo;
185 typedef struct arraydescriptor arraydescriptor;
188 /* constant pool entries *******************************************************
190 All constant pool entries need a data structure which contain the entrys
191 value. In some cases this structure exist already, in the remaining cases
192 this structure must be generated:
194 kind structure generated?
195 ----------------------------------------------------------------------
196 CONSTANT_Class classinfo no
197 CONSTANT_Fieldref constant_FMIref yes
198 CONSTANT_Methodref constant_FMIref yes
199 CONSTANT_InterfaceMethodref constant_FMIref yes
200 CONSTANT_String unicode no
201 CONSTANT_Integer constant_integer yes
202 CONSTANT_Float constant_float yes
203 CONSTANT_Long constant_long yes
204 CONSTANT_Double constant_double yes
205 CONSTANT_NameAndType constant_nameandtype yes
206 CONSTANT_Utf8 unicode no
209 *******************************************************************************/
211 /* data structures for hashtables ********************************************
214 All utf-symbols, javastrings and classes are stored in global hashtables,
215 so every symbol exists only once. Equal symbols have identical pointers.
216 The functions for adding hashtable elements search the table for the
217 element with the specified name/text and return it on success. Otherwise a
218 new hashtable element is created.
220 The hashtables use external linking for handling collisions. The hashtable
221 structure contains a pointer <ptr> to the array of hashtable slots. The
222 number of hashtable slots and therefore the size of this array is specified
223 by the element <size> of hashtable structure. <entries> contains the number
224 of all hashtable elements stored in the table, including those in the
226 The hashtable element structures (utf, literalstring, classinfo) contain
227 both a pointer to the next hashtable element as a link for the external hash
228 chain and the key of the element. The key is computed from the text of
229 the string or the classname by using up to 8 characters.
231 If the number of entries in the hashtable exceeds twice the size of the
232 hashtableslot-array it is supposed that the average length of the
233 external chains has reached a value beyond 2. Therefore the functions for
234 adding hashtable elements (utf_new, class_new, literalstring_new) double
235 the hashtableslot-array. In this restructuring process all elements have
236 to be inserted into the new hashtable and new external chains must be built.
239 example for the layout of a hashtable:
241 hashtable.ptr--> +-------------------+
245 +-------------------+ +-------------------+ +-------------------+
246 | hashtable element |-->| hashtable element |-->| hashtable element |-->NULL
247 +-------------------+ +-------------------+ +-------------------+
248 | hashtable element |
249 +-------------------+ +-------------------+
250 | hashtable element |-->| hashtable element |-->NULL
251 +-------------------+ +-------------------+
252 | hashtable element |-->NULL
253 +-------------------+
257 +-------------------+
262 /* data structure for utf8 symbols ********************************************/
265 utf *hashlink; /* link for external hash chain */
266 int blength; /* text length in bytes */
267 char *text; /* pointer to text */
271 /* data structure of internal javastrings stored in global hashtable **********/
273 struct literalstring {
274 literalstring *hashlink; /* link for external hash chain */
275 java_objectheader *string;
279 /* data structure for calls from c code to java methods */
281 struct jni_callblock {
286 typedef struct jni_callblock jni_callblock;
289 /* data structure for accessing hashtables ************************************/
293 u4 entries; /* number of entries in the table */
294 void **ptr; /* pointer to hashtable */
298 /* data structures of remaining constant pool entries *************************/
300 typedef struct { /* Fieldref, Methodref and InterfaceMethodref */
301 classinfo *class; /* class containing this field/method/interface */
302 utf *name; /* field/method/interface name */
303 utf *descriptor; /* field/method/interface type descriptor string */
307 typedef struct { /* Integer */
312 typedef struct { /* Float */
317 typedef struct { /* Long */
322 typedef struct { /* Double */
327 typedef struct { /* NameAndType (Field or Method) */
328 utf *name; /* field/method name */
329 utf *descriptor; /* field/method type descriptor string */
330 } constant_nameandtype;
333 /* data structures of the runtime system **************************************/
335 /* objects *********************************************************************
337 All objects (and arrays) which resides on the heap need the following
338 header at the beginning of the data structure.
341 struct java_objectheader { /* header for all objects */
342 vftbl *vftbl; /* pointer to virtual function table */
347 /* arrays **********************************************************************
349 All arrays are objects (they need the object header with a pointer
350 to a vftbl (array class table). There is one class for each array
351 type. The array type is described by an arraydescriptor struct
352 which is referenced by the vftbl.
355 /* CAUTION: Don't change the numerical values! These constants (with
356 * the exception of ARRAYTYPE_OBJECT) are used as indices in the
357 * primitive type table.
359 #define ARRAYTYPE_INT PRIMITIVETYPE_INT
360 #define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
361 #define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
362 #define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
363 #define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
364 #define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
365 #define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
366 #define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
367 #define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
369 typedef struct java_arrayheader { /* header for all arrays */
370 java_objectheader objheader; /* object header */
371 s4 size; /* array size */
372 #ifdef SIZE_FROM_CLASSINFO
373 s4 alignedsize; /* phil */
379 /* structs for all kinds of arrays ********************************************/
381 typedef struct java_chararray {
382 java_arrayheader header;
386 typedef struct java_floatheader {
387 java_arrayheader header;
391 typedef struct java_doublearray {
392 java_arrayheader header;
396 /* booleanarray and bytearray need identical memory layout (access methods
397 use the same machine code */
399 typedef struct java_booleanarray {
400 java_arrayheader header;
404 typedef struct java_bytearray {
405 java_arrayheader header;
409 typedef struct java_shortarray {
410 java_arrayheader header;
414 typedef struct java_intarray {
415 java_arrayheader header;
419 typedef struct java_longarray {
420 java_arrayheader header;
424 /* objectarray and arrayarray need identical memory layout (access methods
425 use the same machine code */
427 typedef struct java_objectarray {
428 java_arrayheader header;
429 java_objectheader *data[1];
433 /* structure for primitive classes ********************************************/
435 typedef struct primitivetypeinfo {
436 classinfo *class_wrap; /* class for wrapping primitive type */
437 classinfo *class_primitive; /* primitive class */
438 char *wrapname; /* name of class for wrapping */
439 char typesig; /* one character type signature */
440 char *name; /* name of primitive class */
441 char *arrayname; /* name of primitive array class */
442 classinfo *arrayclass; /* primitive array class */
443 vftbl *arrayvftbl; /* vftbl of primitive array class */
447 /* field, method and class structures *****************************************/
450 typedef struct xtafldinfo {
452 classinfo *fldClassType;
453 classSet *XTAclassSet; /* field class type set */
457 /* fieldinfo ******************************************************************/
459 struct fieldinfo { /* field of a class */
460 s4 flags; /* ACC flags */
461 s4 type; /* basic data type */
462 utf *name; /* name of field */
463 utf *descriptor; /* JavaVM descriptor string of field */
465 s4 offset; /* offset from start of object (instance variables) */
467 imm_union value; /* storage for static values (class variables) */
469 classinfo *class; /* XXX needed by typechecker. Could be optimized */
470 /* away by using constant_FMIref instead of */
471 /* fieldinfo throughout the compiler. */
479 /* exceptiontable *************************************************************/
481 typedef struct xtable { /* exceptiontable entry in a method */
482 s4 startpc; /* start pc of guarded area (inclusive) */
483 struct basicblock *start;
485 s4 endpc; /* end pc of guarded area (exklusive) */
486 struct basicblock *end;
488 s4 handlerpc; /* pc of exception handler */
489 struct basicblock *handler;
491 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
492 struct xtable *next; /* used to build a list of exception when */
493 /* loops are copied */
494 struct xtable *down; /* instead of the old array, a list is used */
498 typedef struct exceptiontable { /* exceptiontable entry in a method */
499 s4 startpc; /* start pc of guarded area (inclusive) */
500 s4 endpc; /* end pc of guarded area (exklusive) */
501 s4 handlerpc; /* pc of exception handler */
502 classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
506 /* methodinfo static info ****************************************************/
507 typedef struct xtainfo {
508 s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
509 classSet *XTAclassSet; /* method class type set */
510 /*classSet *PartClassSet */ /* method class type set */
512 classSetNode *paramClassSet; /* cone set of methods parameters */
514 methSet *calls; /* methods this method calls */
515 methSet *calledBy; /* methods that call this method */
516 methSet *marked; /* methods that marked by this method */
517 /*methSet *markedBy*/
518 fldSet *fldsUsed; /* fields used by this method */
519 /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
520 bool chgdSinceLastParse; /* Changed since last parse ? */
524 /* methodinfo *****************************************************************/
526 struct methodinfo { /* method structure */
527 s4 flags; /* ACC flags */
528 utf *name; /* name of method */
529 utf *descriptor; /* JavaVM descriptor string of method */
530 s4 returntype; /* only temporary valid, return type */
531 classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
532 s4 paramcount; /* only temporary valid, parameter count */
533 u1 *paramtypes; /* only temporary valid, parameter types */
534 classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
536 classinfo *class; /* class, the method belongs to */
537 s4 vftblindex; /* index of method in virtual function table
538 (if it is a virtual method) */
539 s4 maxstack; /* maximum stack depth of method */
540 s4 maxlocals; /* maximum number of local variables */
541 s4 jcodelength; /* length of JavaVM code */
542 u1 *jcode; /* pointer to JavaVM code */
544 s4 exceptiontablelength;/* exceptiontable length */
545 exceptiontable *exceptiontable;
546 /* the exceptiontable */
548 u1 *stubroutine; /* stub for compiling or calling natives */
549 s4 mcodelength; /* legth of generated machine code */
550 u1 *mcode; /* pointer to machine code */
551 u1 *entrypoint; /* entry point in machine code */
556 s4 methodUsed; /* marked (might be used later) /not used /used */
557 s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
558 /* should # method def'd and used be kept after static parse (will it be used?) */
564 /* innerclassinfo *************************************************************/
566 typedef struct innerclassinfo {
567 classinfo *inner_class; /* inner class pointer */
568 classinfo *outer_class; /* outer class pointer */
569 utf *name; /* innerclass name */
570 s4 flags; /* ACC flags */
574 /* classinfo ******************************************************************/
576 struct classinfo { /* class structure */
577 java_objectheader header; /* classes are also objects */
578 java_objectarray* signers;
579 struct java_security_ProtectionDomain* pd;
580 struct java_lang_VMClass* vmClass;
581 struct java_lang_reflect_Constructor* constructor;
584 s4 initializing_thread; /* gnu classpath */
585 s4 erroneous_state; /* gnu classpath */
586 struct gnu_classpath_RawData* vmData; /* gnu classpath */
588 s4 flags; /* ACC flags */
589 utf *name; /* class name */
591 s4 cpcount; /* number of entries in constant pool */
592 u1 *cptags; /* constant pool tags */
593 voidptr *cpinfos; /* pointer to constant pool info structures */
595 classinfo *super; /* super class pointer */
596 classinfo *sub; /* sub class pointer */
597 classinfo *nextsub; /* pointer to next class in sub class list */
599 s4 interfacescount; /* number of interfaces */
600 classinfo **interfaces; /* pointer to interfaces */
602 s4 fieldscount; /* number of fields */
603 fieldinfo *fields; /* field table */
605 s4 methodscount; /* number of methods */
606 methodinfo *methods; /* method table */
608 listnode listnode; /* linkage */
610 bool initialized; /* true, if class already initialised */
611 bool loaded; /* true, if class already loaded */
612 bool linked; /* true, if class already linked */
613 s4 index; /* hierarchy depth (classes) or index
615 s4 instancesize; /* size of an instance of this class */
616 #ifdef SIZE_FROM_CLASSINFO
617 s4 alignedsize; /* size of an instance, aligned to the
618 allocation size on the heap */
621 vftbl *vftbl; /* pointer to virtual function table */
623 methodinfo *finalizer; /* finalizer method */
625 u2 innerclasscount; /* number of inner classes */
626 innerclassinfo *innerclass;
628 classinfo *hashlink; /* link for external hash chain */
629 bool classvftbl; /* has its own copy of the Class vtbl */
631 s4 classUsed; /* 0= not used 1 = used CO-RT */
633 classSetNode *impldBy; /* implemented by class set */
636 /* check if class is an array class. Only use for linked classes! */
637 #define CLASS_IS_ARRAY(clsinfo) (clsinfo->vftbl->arraydesc != NULL)
640 /* virtual function table ******************************************************
642 The vtbl has a bidirectional layout with open ends at both sides.
643 interfacetablelength gives the number of entries of the interface table at
644 the start of the vftbl. The vftbl pointer points to &interfacetable[0].
645 vftbllength gives the number of entries of table at the end of the vftbl.
647 runtime type check (checkcast):
649 Different methods are used for runtime type check depending on the
650 argument of checkcast/instanceof.
652 A check against a class is implemented via relative numbering on the class
653 hierachy tree. The tree is numbered in a depth first traversal setting
654 the base field and the diff field. The diff field gets the result of
655 (high - base) so that a range check can be implemented by an unsigned
656 compare. A sub type test is done by checking the inclusion of base of
657 the sub class in the range of the superclass.
659 A check against an interface is implemented via the interfacevftbl. If the
660 interfacevftbl contains a nonnull value a class is a subclass of this
665 Like standard virtual methods interface methods are called using
666 virtual function tables. All interfaces are numbered sequentially
667 (starting with zero). For each class there exist an interface table
668 of virtual function tables for each implemented interface. The length
669 of the interface table is determined by the highest number of an
670 implemented interface.
672 The following example assumes a class which implements interface 0 and 3:
674 interfacetablelength = 4
677 +-----------+ | method 2 |---> method z
678 | class | | method 1 |---> method y
679 +-----------+ | method 0 |---> method x
680 | ivftbl 0 |----------> +----------+
681 vftblptr ---> +-----------+
682 | ivftbl -1 |--> NULL +----------+
683 | ivftbl -2 |--> NULL | method 1 |---> method x
684 | ivftbl -3 |-----+ | method 0 |---> method a
685 +-----------+ +----> +----------+
692 interfacevftbllength ---> +---------------+
694 *******************************************************************************/
697 methodptr *interfacetable[1]; /* interface table (access via macro) */
699 classinfo *class; /* class, the vtbl belongs to */
701 arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
703 s4 vftbllength; /* virtual function table length */
704 s4 interfacetablelength; /* interface table length */
706 s4 baseval; /* base for runtime type check */
707 /* (-index for interfaces) */
708 s4 diffval; /* high - base for runtime type check */
710 s4 *interfacevftbllength; /* length of interface vftbls */
712 methodptr table[1]; /* class vftbl */
715 #define VFTBLINTERFACETABLE(v,i) (v)->interfacetable[-i]
718 /* arraydescriptor ************************************************************
720 For every array class an arraydescriptor is allocated which
721 describes the array class.
722 The arraydescriptor is referenced from the vftbl of the array
725 *******************************************************************************/
727 struct arraydescriptor {
728 vftbl *componentvftbl; /* vftbl of the component type, NULL for primit. */
729 vftbl *elementvftbl; /* vftbl of the element type, NULL for primitive */
730 short arraytype; /* ARRAYTYPE_* constant */
731 short dimension; /* dimension of the array (always >= 1) */
732 s4 dataoffset; /* offset of the array data from object pointer */
733 s4 componentsize; /* size of a component in bytes */
734 short elementtype; /* ARRAYTYPE_* constant (XXX optimize away?) */
738 /* references to some system classes ******************************************/
740 extern classinfo *class_java_lang_Object;
741 extern classinfo *class_java_lang_String;
742 extern classinfo *class_java_lang_Throwable;
743 extern classinfo *class_java_lang_Cloneable;
744 extern classinfo *class_java_io_Serializable;
745 extern classinfo *class_java_lang_ClassCastException;
746 extern classinfo *class_java_lang_NullPointerException;
747 extern classinfo *class_java_lang_ArrayIndexOutOfBoundsException;
748 extern classinfo *class_java_lang_NegativeArraySizeException;
749 extern classinfo *class_java_lang_OutOfMemoryError;
750 extern classinfo *class_java_lang_ArithmeticException;
751 extern classinfo *class_java_lang_ArrayStoreException;
752 extern classinfo *class_java_lang_ThreadDeath;
753 extern classinfo *pseudo_class_Arraystub;
754 extern classinfo *pseudo_class_Null;
755 extern classinfo *pseudo_class_New;
756 extern vftbl *pseudo_class_Arraystub_vftbl;
759 /* instances of some system classes *******************************************/
761 extern java_objectheader *proto_java_lang_ClassCastException;
762 extern java_objectheader *proto_java_lang_NullPointerException;
763 extern java_objectheader *proto_java_lang_ArrayIndexOutOfBoundsException;
764 extern java_objectheader *proto_java_lang_NegativeArraySizeException;
765 extern java_objectheader *proto_java_lang_OutOfMemoryError;
766 extern java_objectheader *proto_java_lang_ArithmeticException;
767 extern java_objectheader *proto_java_lang_ArrayStoreException;
768 extern java_objectheader *proto_java_lang_ThreadDeath;
771 /* flag variables *************************************************************/
773 extern bool compileall;
774 extern bool runverbose;
776 extern bool opt_rt; /* Rapid Type Analysis for better inlining CO-RT*/
777 extern bool opt_xta; /* X Type Analysis for better inlining CO-XTA*/
778 extern bool opt_vta; /* Variable Type Analysis for better inlining CO-VTA*/
779 #ifdef TYPECHECK_VERBOSE_OPT
780 extern bool typecheckverbose;
783 //extern int pClassHeir;
784 //extern int pCallgraph;
785 //extern int pOpcodes;
788 //extern void RT_jit_parse(methodinfo *m);
791 /* statistic variables ********************************************************/
793 extern int count_class_infos;
794 extern int count_const_pool_len;
795 extern int count_vftbl_len;
796 extern int count_utf_len;
797 extern int count_all_methods;
798 extern int count_vmcode_len;
799 extern int count_extable_len;
800 extern int count_class_loads;
801 extern int count_class_inits;
802 extern int count_utf_new;
803 extern int count_utf_new_found;
806 /* table of primitive types ***************************************************/
808 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_
809 * constants (except ARRAYTYPE_OBJECT).
811 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
814 /* macros for descriptor parsing **********************************************/
816 /* SKIP_FIELDDESCRIPTOR:
817 * utf_ptr must point to the first character of a field descriptor.
818 * After the macro call utf_ptr points to the first character after
819 * the field descriptor.
821 * CAUTION: This macro does not check for an unexpected end of the
822 * descriptor. Better use SKIP_FIELDDESCRIPTOR_SAFE.
824 #define SKIP_FIELDDESCRIPTOR(utf_ptr) \
825 do { while (*(utf_ptr)=='[') (utf_ptr)++; \
826 if (*(utf_ptr)++=='L') \
827 while(*(utf_ptr)++ != ';') /* skip */; } while(0)
829 /* SKIP_FIELDDESCRIPTOR_SAFE:
830 * utf_ptr must point to the first character of a field descriptor.
831 * After the macro call utf_ptr points to the first character after
832 * the field descriptor.
835 * utf_ptr....points to first char of descriptor
836 * end_ptr....points to first char after the end of the string
837 * errorflag..must be initialized (to false) by the caller!
839 * utf_ptr....points to first char after the descriptor
840 * errorflag..set to true if the string ended unexpectedly
842 #define SKIP_FIELDDESCRIPTOR_SAFE(utf_ptr,end_ptr,errorflag) \
843 do { while ((utf_ptr) != (end_ptr) && *(utf_ptr)=='[') (utf_ptr)++; \
844 if ((utf_ptr) == (end_ptr)) \
845 (errorflag) = true; \
847 if (*(utf_ptr)++=='L') { \
848 while((utf_ptr) != (end_ptr) && *(utf_ptr)++ != ';') \
850 if ((utf_ptr)[-1] != ';') \
851 (errorflag) = true; }} while(0)
853 #endif /* _GLOBAL_H */
857 * These are local overrides for various environment variables in Emacs.
858 * Please do not remove this and leave it at the end of the file, where
859 * Emacs will automagically detect them.
860 * ---------------------------------------------------------------------
863 * indent-tabs-mode: t