Initial import of s390 codegen, codebase is copyed from x86_64.
[cacao.git] / src / vm / global.h
index e8c8fb377e641964d9c332d3140a032b02d2d471..5943147facc44310f03490214740fd565606802f 100644 (file)
 
    Authors: Reinhard Grafl
             Andreas Krall
-
-   Changes: Mark Probst
+            Mark Probst
             Philipp Tomsich
             Edwin Steiner
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: global.h 5013 2006-06-06 11:22:56Z twisti $
+   $Id: global.h 6216 2006-12-18 18:21:37Z twisti $
 
 */
 
@@ -51,11 +50,20 @@ typedef void *voidptr;                  /* generic pointer                    */
 typedef void (*functionptr) (void);     /* generic function pointer           */
 typedef u1* methodptr;
 
-typedef int   bool;                     /* boolean data type                  */
+typedef unsigned int bool;              /* boolean data type                  */
+
+#define true         1
+#define false        0
 
-#define true  1
-#define false 0
 
+#if defined(ENABLE_SSA)
+/* immediate to get an addidional target Local Var Index */
+/* for IINC in Combination with SSA */
+struct imm {
+       s4 i;
+       s4 op1_t;
+};
+#endif
 
 /* immediate data union */
 
@@ -67,6 +75,9 @@ typedef union {
        void       *a;
        functionptr fp;
        u1          b[8];
+#if defined(ENABLE_SSA)
+       struct imm  _i;
+#endif
 } imm_union;
 
 
@@ -76,25 +87,39 @@ typedef struct java_objectheader java_objectheader;
 typedef struct java_objectarray java_objectarray;
 
 
-/* define some CACAO paths ****************************************************/
-
-#define CLASSPATH_LIBRARY_PATH      CLASSPATH_LIBDIR "/classpath"
-
-
 #define MAX_ALIGN 8             /* most generic alignment for JavaVM values   */
 
 
 /* basic data types ***********************************************************/
 
-/* CAUTION: jit/jit.h relies on these numerical values! */
-#define TYPE_INT      0         /* the JavaVM types must numbered in the      */
-#define TYPE_LONG     1         /* same order as the ICMD_Ixxx to ICMD_Axxx   */
-#define TYPE_FLOAT    2         /* instructions (LOAD and STORE)              */
-#define TYPE_DOUBLE   3         /* integer, long, float, double, address      */
-#define TYPE_ADDRESS  4         /* all other types can be numbered arbitrarly */
+/* The JavaVM types must numbered in the same order as the ICMD_Ixxx
+   to ICMD_Axxx instructions (LOAD and STORE).  All other types can be
+   numbered arbitrarily. */
+
+#define TYPE_INT     0
+#define TYPE_LNG     1
+#define TYPE_FLT     2
+#define TYPE_DBL     3
+#define TYPE_ADR     4
+
+#define TYPE_RET     8   /* must not share bits with TYPE_FLT or TYPE_LNG */
 
 #define TYPE_VOID    10
 
+
+#define IS_INT_LNG_TYPE(a)      (!((a) & TYPE_FLT))
+#define IS_FLT_DBL_TYPE(a)      ((a) & TYPE_FLT)
+#define IS_2_WORD_TYPE(a)       ((a) & TYPE_LNG)
+
+#define IS_INT_TYPE(a)          ((a) == TYPE_INT)
+#define IS_LNG_TYPE(a)          ((a) == TYPE_LNG)
+#define IS_FLT_TYPE(a)          ((a) == TYPE_FLT)
+#define IS_DBL_TYPE(a)          ((a) == TYPE_DBL)
+#define IS_ADR_TYPE(a)          ((a) == TYPE_ADR)
+
+#define IS_VOID_TYPE(a)         ((a) == TYPE_VOID)
+
+
 /* primitive data types *******************************************************/
 
 /* These values are used in parsed descriptors and in some other
@@ -107,9 +132,9 @@ typedef struct java_objectarray java_objectarray;
    used as indices into the primitive type table. */
 
 #define PRIMITIVETYPE_INT     TYPE_INT
-#define PRIMITIVETYPE_LONG    TYPE_LONG
-#define PRIMITIVETYPE_FLOAT   TYPE_FLOAT
-#define PRIMITIVETYPE_DOUBLE  TYPE_DOUBLE
+#define PRIMITIVETYPE_LONG    TYPE_LNG
+#define PRIMITIVETYPE_FLOAT   TYPE_FLT
+#define PRIMITIVETYPE_DOUBLE  TYPE_DBL
 #define PRIMITIVETYPE_DUMMY1  TYPE_ADR     /* not used! */
 #define PRIMITIVETYPE_BYTE    5
 #define PRIMITIVETYPE_CHAR    6
@@ -120,14 +145,14 @@ typedef struct java_objectarray java_objectarray;
 
 /* some Java related defines **************************************************/
 
-#define JAVA_VERSION    "1.4.2"         /* this version is supported by CACAO */
-#define CLASS_VERSION   "49.0"
+#define JAVA_VERSION    "1.5.0"         /* this version is supported by CACAO */
+#define CLASS_VERSION   "50.0"
 
 
 /* Java class file constants **************************************************/
 
 #define MAGIC             0xCAFEBABE
-#define MAJOR_VERSION     49
+#define MAJOR_VERSION     50
 #define MINOR_VERSION     0
 
 
@@ -178,6 +203,11 @@ typedef struct java_objectarray java_objectarray;
 #define ACC_CLASS_REFLECT_MASK 0x0000ffff     /* flags reported by reflection */
 #define ACC_CLASS_HAS_POINTERS 0x00010000     /* instance contains pointers   */
 
+/* special flags used in methodinfo *******************************************/
+
+#define ACC_METHOD_IMPLEMENTED 0x00010000     /* there is an implementation   */
+#define ACC_METHOD_MONOMORPHIC 0x00020000     /* currently monomorphic method */
+
 
 /* data structures of the runtime system **************************************/
 
@@ -186,13 +216,19 @@ typedef struct java_objectarray java_objectarray;
    All objects (and arrays) which resides on the heap need the
    following header at the beginning of the data structure.
 
+   TODO: Include detailed description from the Wiki (ObjectHeader) here.
+
 *******************************************************************************/
 
-struct java_objectheader {              /* header for all objects             */
-       struct _vftbl            *vftbl;    /* pointer to virtual function table  */
+#define HDRFLAG_FLC 0x01
+
+struct java_objectheader {             /* header for all objects              */
+       struct _vftbl            *vftbl;   /* pointer to virtual function table   */
 #if defined(ENABLE_THREADS)
        struct lock_record_t *monitorPtr;
-       ptrint                flcword;      /* word containing the FLC bit        */
+#endif
+#if defined(ENABLE_THREADS) || defined(ENABLE_GC_CACAO)
+       ptrint                hdrflags;    /* word containing the FLC and GC bits */
 #endif
 };
 
@@ -287,6 +323,24 @@ void compiler_lock();
 void compiler_unlock();
 #endif
 
+
+/* global constants related to the verifier ***********************************/
+
+/* The verifier needs additional variables in the variable array. Since these */
+/* must be reserved and set by parse.c and stack.c, we define these numbers   */
+/* here to avoid mysterious hard-coded constants.                             */
+/* stack.c needs an extra variable if the verifier is disabled.               */
+
+#if defined(ENABLE_VERIFIER)
+#    define VERIFIER_EXTRA_LOCALS  1
+#    define VERIFIER_EXTRA_VARS    1
+#    define STACK_EXTRA_VARS       0
+#else
+#    define VERIFIER_EXTRA_LOCALS  0
+#    define VERIFIER_EXTRA_VARS    0
+#    define STACK_EXTRA_VARS       1
+#endif
+
 #endif /* _GLOBAL_H */