-/* exceptiontable *************************************************************/
-
-struct exceptiontable { /* exceptiontable entry in a method */
- s4 startpc; /* start pc of guarded area (inclusive) */
- struct basicblock *start;
-
- s4 endpc; /* end pc of guarded area (exklusive) */
- struct basicblock *end;
-
- s4 handlerpc; /* pc of exception handler */
- struct basicblock *handler;
-
- classinfo *catchtype; /* catchtype of exception (NULL == catchall) */
- exceptiontable *next; /* used to build a list of exception when */
- /* loops are copied */
- exceptiontable *down; /* instead of the old array, a list is used */
-};
-
-
-/* methodinfo static info ****************************************************/
-
-typedef struct xtainfo {
- s4 XTAmethodUsed; /* XTA if used in callgraph - not used /used */
- classSet *XTAclassSet; /* method class type set */
- /*classSet *PartClassSet */ /* method class type set */
-
- classSetNode *paramClassSet; /* cone set of methods parameters */
-
- methSet *calls; /* methods this method calls */
- methSet *calledBy; /* methods that call this method */
- methSet *marked; //not in Dez /* methods that marked by this method */
- methSet *markedBy;
- fldSet *fldsUsed; /* fields used by this method */
- /*methSetNode *interfaceCalls*/ /* methods this method calls as interface */
- bool chgdSinceLastParse; /* Changed since last parse ? */
-} xtainfo;
-
-
-/* lineinfo *****************************************************************/
-
-struct lineinfo {
- u2 start_pc;
- u2 line_number;
-};
-
-
-/* methodinfo *****************************************************************/
-
-struct methodinfo { /* method structure */
- s4 flags; /* ACC flags */
- utf *name; /* name of method */
- utf *descriptor; /* JavaVM descriptor string of method */
- s4 returntype; /* only temporary valid, return type */
- classinfo *returnclass; /* pointer to classinfo for the rtn type */ /*XTA*/
- s4 paramcount; /* only temporary valid, parameter count */
- u1 *paramtypes; /* only temporary valid, parameter types */
- classinfo **paramclass; /* pointer to classinfo for a parameter */ /*XTA*/
-
- bool isleafmethod; /* does method call subroutines */
-
- classinfo *class; /* class, the method belongs to */
- s4 vftblindex; /* index of method in virtual function table
- (if it is a virtual method) */
- s4 maxstack; /* maximum stack depth of method */
- s4 maxlocals; /* maximum number of local variables */
- s4 jcodelength; /* length of JavaVM code */
- u1 *jcode; /* pointer to JavaVM code */
-
- s4 basicblockcount; /* number of basic blocks */
- struct basicblock *basicblocks; /* points to basic block array */
- s4 *basicblockindex; /* a table which contains for every byte */
- /* of JavaVM code a basic block index if */
- /* at this byte is the start of a basic */
- /* block */
-
- s4 instructioncount; /* number of JavaVM instructions */
- struct instruction *instructions; /* points to intermediate code instructions */
-
- s4 stackcount; /* number of stack elements */
- struct stackelement *stack; /* points to intermediate code instructions */
-
- s4 exceptiontablelength;/* exceptiontable length */
- exceptiontable *exceptiontable; /* the exceptiontable */
-
- u2 thrownexceptionscount;/*number of exceptions declared to be thrown by a method*/
- classinfo **thrownexceptions; /*array of classinfos of declared exceptions*/
-
- u2 linenumbercount; /* number of linenumber attributes */
- lineinfo *linenumbers; /* array of lineinfo items */
-
- struct registerdata *registerdata; /* struct with all regalloc stuff */
-
- u1 *stubroutine; /* stub for compiling or calling natives */
- s4 mcodelength; /* legth of generated machine code */
- u1 *mcode; /* pointer to machine code */
- u1 *entrypoint; /* entry point in machine code */
-
- /*rtainfo rta;*/
- xtainfo *xta;
-
- s4 methodUsed; /* marked (might be used later) /not used /used */
- s4 monoPoly; /* call is mono or poly or unknown */ /*RT stats */
- /* should # method def'd and used be kept after static parse (will it be used?) */
- s4 subRedefs;
- s4 subRedefsUsed;
- s4 nativelyoverloaded; /*used in header.c and only valid there*/
-};
-
-
-/* innerclassinfo *************************************************************/
-
-typedef struct innerclassinfo {
- classinfo *inner_class; /* inner class pointer */
- classinfo *outer_class; /* outer class pointer */
- utf *name; /* innerclass name */
- s4 flags; /* ACC flags */
-} innerclassinfo;
-
-
-/* classinfo ******************************************************************/
-
-struct classinfo { /* class structure */
- java_objectheader header; /* classes are also objects */
- java_objectarray* signers;
- struct java_security_ProtectionDomain* pd;
- struct java_lang_VMClass* vmClass;
- struct java_lang_reflect_Constructor* constructor;
-
- s4 initializing_thread; /* gnu classpath */
- s4 erroneous_state; /* gnu classpath */
- struct gnu_classpath_RawData* vmData; /* gnu classpath */
-
- s4 flags; /* ACC flags */
- utf *name; /* class name */
-
- s4 cpcount; /* number of entries in constant pool */
- u1 *cptags; /* constant pool tags */
- voidptr *cpinfos; /* pointer to constant pool info structures */
-
- classinfo *super; /* super class pointer */
- classinfo *sub; /* sub class pointer */
- classinfo *nextsub; /* pointer to next class in sub class list */
-
- s4 interfacescount; /* number of interfaces */
- classinfo **interfaces; /* pointer to interfaces */
-
- s4 fieldscount; /* number of fields */
- fieldinfo *fields; /* field table */
-
- s4 methodscount; /* number of methods */
- methodinfo *methods; /* method table */
-
- listnode listnode; /* linkage */
-
- bool initialized; /* true, if class already initialised */
- bool initializing; /* flag for the compiler */
- bool loaded; /* true, if class already loaded */
- bool linked; /* true, if class already linked */
- s4 index; /* hierarchy depth (classes) or index
- (interfaces) */
- s4 instancesize; /* size of an instance of this class */
-#ifdef SIZE_FROM_CLASSINFO
- s4 alignedsize; /* size of an instance, aligned to the
- allocation size on the heap */
-#endif
-
- vftbl_t *vftbl; /* pointer to virtual function table */
-
- methodinfo *finalizer; /* finalizer method */
-
- u2 innerclasscount; /* number of inner classes */
- innerclassinfo *innerclass;
-
- classinfo *hashlink; /* link for external hash chain */
- bool classvftbl; /* has its own copy of the Class vtbl */
-
- s4 classUsed; /* 0= not used 1 = used CO-RT */
-
- classSetNode *impldBy; /* implemented by class set */
- utf *packagename; /* full name of the package */
- utf *sourcefile; /* classfile name containing this class */
- java_objectheader *classloader; /* 0 for bootstrap classloader */
-};
-
-/* check if class is an array class. Only use for linked classes! */
-#define CLASS_IS_ARRAY(clsinfo) ((clsinfo)->vftbl->arraydesc != NULL)
-
-
-/* virtual function table ******************************************************
-
- The vtbl has a bidirectional layout with open ends at both sides.
- interfacetablelength gives the number of entries of the interface table at
- the start of the vftbl. The vftbl pointer points to &interfacetable[0].
- vftbllength gives the number of entries of table at the end of the vftbl.
-
- runtime type check (checkcast):
-
- Different methods are used for runtime type check depending on the
- argument of checkcast/instanceof.
-
- A check against a class is implemented via relative numbering on the class
- hierachy tree. The tree is numbered in a depth first traversal setting
- the base field and the diff field. The diff field gets the result of
- (high - base) so that a range check can be implemented by an unsigned
- compare. A sub type test is done by checking the inclusion of base of
- the sub class in the range of the superclass.
-
- A check against an interface is implemented via the interfacevftbl. If the
- interfacevftbl contains a nonnull value a class is a subclass of this
- interface.
-
- interfacetable:
-
- Like standard virtual methods interface methods are called using
- virtual function tables. All interfaces are numbered sequentially
- (starting with zero). For each class there exist an interface table
- of virtual function tables for each implemented interface. The length
- of the interface table is determined by the highest number of an
- implemented interface.
-
- The following example assumes a class which implements interface 0 and 3:
-
- interfacetablelength = 4
-
- | ... | +----------+
- +-----------+ | method 2 |---> method z
- | class | | method 1 |---> method y
- +-----------+ | method 0 |---> method x
- | ivftbl 0 |----------> +----------+
- vftblptr ---> +-----------+
- | ivftbl -1 |--> NULL +----------+
- | ivftbl -2 |--> NULL | method 1 |---> method x
- | ivftbl -3 |-----+ | method 0 |---> method a
- +-----------+ +----> +----------+
-
- +---------------+
- | length 3 = 2 |
- | length 2 = 0 |
- | length 1 = 0 |
- | length 0 = 3 |
- interfacevftbllength ---> +---------------+
-
-*******************************************************************************/
-
-struct _vftbl {
- methodptr *interfacetable[1]; /* interface table (access via macro) */
-
- classinfo *class; /* class, the vtbl belongs to */
-
- arraydescriptor *arraydesc; /* for array classes, otherwise NULL */
-
- s4 vftbllength; /* virtual function table length */
- s4 interfacetablelength; /* interface table length */
-
- s4 baseval; /* base for runtime type check */
- /* (-index for interfaces) */
- s4 diffval; /* high - base for runtime type check */
-
- s4 *interfacevftbllength; /* length of interface vftbls */
-
- methodptr table[1]; /* class vftbl */
-};
-