Some new x86_64 entries.
[cacao.git] / global.h
index 7247302ba894d1391611be941e6bee284d65909c..538bf874f50f3215045bfddf47271a9d6abbfb2b 100644 (file)
--- a/global.h
+++ b/global.h
@@ -31,7 +31,7 @@
             Philipp Tomsich
                        Edwin Steiner
 
-   $Id: global.h 1173 2004-06-16 14:56:18Z jowenn $
+   $Id: global.h 1377 2004-08-01 22:01:00Z stefan $
 
 */
 
@@ -47,6 +47,7 @@
 
 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
 #include <pthread.h>
+#include <semaphore.h>
 #endif
 
 #define STATISTICS          /* if enabled collects program statistics         */
@@ -67,7 +68,7 @@
  * categories for stack manipulations (POP,POP2,SWAP,DUP,DUP2,DUP_X1,
  * DUP2_X1,DUP_X2,DUP2_X2).
  */
-/* #define TYPECHECK_STACK_COMPCAT */
+#define TYPECHECK_STACK_COMPCAT
 
 /*
  * Macros for configuration of the typechecking code
@@ -101,6 +102,8 @@ typedef int   bool;             /* boolean data type */
 #define true  1
 #define false 0
 
+typedef void (*functionptr) (); /* generic function pointer */
+
 
 /* immediate data union */
 
@@ -129,8 +132,6 @@ typedef union {
 #define PRIMITIVETYPE_BOOLEAN 7
 #define PRIMITIVETYPE_VOID    8
 
-typedef void (*functionptr) (); /* generic function pointer */
-
 
 #define MAX_ALIGN 8             /* most generic alignment for JavaVM values   */
 
@@ -187,9 +188,10 @@ typedef struct utf utf;
 typedef struct literalstring literalstring;
 typedef struct java_objectheader java_objectheader; 
 typedef struct classinfo classinfo; 
-typedef struct vftbl vftbl;
+typedef struct _vftbl vftbl_t;
 typedef u1* methodptr;
 typedef struct fieldinfo  fieldinfo; 
+typedef struct exceptiontable exceptiontable;
 typedef struct methodinfo methodinfo; 
 typedef struct lineinfo lineinfo; 
 typedef struct arraydescriptor arraydescriptor;
@@ -378,9 +380,9 @@ typedef struct {            /* NameAndType (Field or Method)                  */
 */
 
 struct java_objectheader {              /* header for all objects             */
-       vftbl *vftbl;                       /* pointer to virtual function table  */
+       vftbl_t *vftbl;                     /* pointer to virtual function table  */
 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
-       long monitorBits;
+       void *monitorPtr;
 #endif
 };
 
@@ -482,7 +484,7 @@ typedef struct primitivetypeinfo {
        char      *name;                     /* name of primitive class           */
        char      *arrayname;                /* name of primitive array class     */
        classinfo *arrayclass;               /* primitive array class             */
-       vftbl     *arrayvftbl;               /* vftbl of primitive array class    */
+       vftbl_t     *arrayvftbl;             /* vftbl of primitive array class    */
 } primitivetypeinfo;
 
 
@@ -515,12 +517,10 @@ struct fieldinfo {              /* field of a class                                 */
        xtafldinfo *xta;
 };
 
-struct basicblock;
-
 
 /* exceptiontable *************************************************************/
 
-typedef struct xtable {         /* exceptiontable entry in a method           */
+struct exceptiontable {         /* exceptiontable entry in a method           */
        s4         startpc;         /* start pc of guarded area (inclusive)       */
        struct basicblock *start;
 
@@ -531,21 +531,14 @@ typedef struct xtable {         /* exceptiontable entry in a method           */
        struct basicblock *handler;
 
        classinfo *catchtype;       /* catchtype of exception (NULL == catchall)  */
-       struct xtable *next;        /* used to build a list of exception when     */
+       exceptiontable *next;       /* used to build a list of exception when     */
                                    /* loops are copied */
-       struct xtable *down;        /* instead of the old array, a list is used   */
-} xtable;
-
-
-typedef struct exceptiontable { /* exceptiontable entry in a method           */
-       s4         startpc;         /* start pc of guarded area (inclusive)       */
-       s4         endpc;           /* end pc of guarded area (exklusive)         */
-       s4         handlerpc;       /* pc of exception handler                    */
-       classinfo *catchtype;       /* catchtype of exception (NULL == catchall)  */
-} exceptiontable;
+       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                 */ 
@@ -564,14 +557,17 @@ typedef struct xtainfo {
 
 
 /* lineinfo *****************************************************************/
+
 struct lineinfo {
        u2 start_pc;
        u2 line_number;
 };
 
+
 /* methodinfo *****************************************************************/
 
 struct methodinfo {                 /* method structure                       */
+       java_objectheader header;       /* we need this in jit's monitorenter     */
        s4             flags;               /* ACC flags                              */
        utf       *name;                /* name of method                         */
        utf       *descriptor;          /* JavaVM descriptor string of method     */
@@ -580,7 +576,9 @@ struct methodinfo {                 /* method structure                       */
        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)            */
@@ -589,16 +587,33 @@ struct methodinfo {                 /* method structure                       */
        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 (start_pc,line_number)*/
+       u2         linenumbercount;     /* number of linenumber attributes        */
+       lineinfo  *linenumbers;         /* array of lineinfo items                */
 
-       u1        *stubroutine;         /* stub for compiling or calling natives  */    
+       struct registerdata *registerdata; /* struct with all regalloc stuff      */
+
+       struct codegendata *codegendata;/* struct with codegen 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            */
@@ -661,6 +676,7 @@ struct classinfo {                /* class structure                          */
        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
@@ -671,7 +687,7 @@ struct classinfo {                /* class structure                          */
                                                                         allocation size on the heap              */
 #endif
 
-       vftbl      *vftbl;            /* pointer to virtual function table        */
+       vftbl_t      *vftbl;          /* pointer to virtual function table        */
 
        methodinfo *finalizer;        /* finalizer method                         */
 
@@ -749,7 +765,7 @@ struct classinfo {                /* class structure                          */
 
 *******************************************************************************/
 
-struct vftbl {
+struct _vftbl {
        methodptr   *interfacetable[1];    /* interface table (access via macro)  */
 
        classinfo   *class;                /* class, the vtbl belongs to          */
@@ -781,8 +797,8 @@ struct vftbl {
 *******************************************************************************/
 
 struct arraydescriptor {
-       vftbl *componentvftbl;   /* vftbl of the component type, NULL for primit. */
-       vftbl *elementvftbl;     /* vftbl of the element type, NULL for primitive */
+       vftbl_t *componentvftbl; /* vftbl of the component type, NULL for primit. */
+       vftbl_t *elementvftbl;   /* vftbl of the element type, NULL for primitive */
        short  arraytype;        /* ARRAYTYPE_* constant                          */
        short  dimension;        /* dimension of the array (always >= 1)          */
     s4     dataoffset;       /* offset of the array data from object pointer  */
@@ -794,14 +810,7 @@ struct arraydescriptor {
 /* flag variables *************************************************************/
 
 extern bool cacao_initializing;
-extern bool compileall;
-extern bool runverbose;         
-extern bool verboseexception;         
-extern bool verbose;         
-extern bool opt_rt;             /* Rapid Type Analysis for better inlining CO-RT*/
-extern bool opt_xta;            /* X Type Analysis for better inlining    CO-XTA*/
-extern bool opt_vta;            /* Variable Type Analysis for better inlining    CO-VTA*/
-extern bool opt_verify;         /* true if classfiles should be verified      */
+
 #ifdef TYPECHECK_VERBOSE_OPT
 extern bool typecheckverbose;
 #endif
@@ -814,21 +823,6 @@ extern bool typecheckverbose;
 /*extern void RT_jit_parse(methodinfo *m);*/
 
 
-/* statistic variables ********************************************************/
-
-extern int count_class_infos;
-extern int count_const_pool_len;
-extern int count_vftbl_len;
-extern int count_utf_len;
-extern int count_all_methods;
-extern int count_vmcode_len;
-extern int count_extable_len;
-extern int count_class_loads;
-extern int count_class_inits;
-extern int count_utf_new;
-extern int count_utf_new_found;
-
-
 /* table of primitive types ***************************************************/
 
 /* This array can be indexed by the PRIMITIVETYPE_ and ARRAYTYPE_