* src/vm/jit/patcher-common.c (patcher_handler): Call LOCK_MONITOR_EXIT instead of...
[cacao.git] / src / vm / global.h
index a8a834a0beb88f9f15639ac4d71bbd3d6e42c3b4..ab6165cd98c154c05ed7047c705323d9208a6387 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/global.h - global definitions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2007, 2006 R. Grafl, A. Krall, C. Kruegel,
    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
    J. Wenninger, Institut f. Computersprachen - TU Wien
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Reinhard Grafl
-            Andreas Krall
-
-   Changes: Mark Probst
-            Philipp Tomsich
-            Edwin Steiner
-            Joseph Wenninger
-            Christian Thalinger
-
-   $Id: global.h 5910 2006-11-05 10:31:32Z edwin $
+   $Id: global.h 8210 2007-07-18 12:51:00Z twisti $
 
 */
 
@@ -82,6 +71,14 @@ typedef union {
 } imm_union;
 
 
+/* alignment macros ***********************************************************/
+
+#define ALIGN_EVEN(a)                   ((a) = (((a) + 1) & ~1))
+#define ALIGN_ODD(a)                    ((a) =   (a) | 1       )
+
+#define ALIGN_2(a)                      ALIGN_EVEN(a)
+
+
 /* forward typedefs ***********************************************************/
 
 typedef struct java_objectheader java_objectheader; 
@@ -121,39 +118,16 @@ typedef struct java_objectarray java_objectarray;
 #define IS_VOID_TYPE(a)         ((a) == TYPE_VOID)
 
 
-/* primitive data types *******************************************************/
-
-/* These values are used in parsed descriptors and in some other
-   places were the different types handled internally as TYPE_INT have
-   to be distinguished. */
-
-#define PRIMITIVETYPE_COUNT  11  /* number of primitive types (+ dummies)     */
-
-/* CAUTION: Don't change the numerical values! These constants are
-   used as indices into the primitive type table. */
-
-#define PRIMITIVETYPE_INT     TYPE_INT
-#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
-#define PRIMITIVETYPE_SHORT   7
-#define PRIMITIVETYPE_BOOLEAN 8
-#define PRIMITIVETYPE_DUMMY2  9            /* not used! */
-#define PRIMITIVETYPE_VOID    TYPE_VOID
-
 /* 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
 
 
@@ -201,13 +175,23 @@ typedef struct java_objectarray java_objectarray;
 
 /* special flags used in classinfo ********************************************/
 
-#define ACC_CLASS_REFLECT_MASK 0x0000ffff     /* flags reported by reflection */
-#define ACC_CLASS_HAS_POINTERS 0x00010000     /* instance contains pointers   */
+#define ACC_CLASS_REFLECT_MASK      0x0000ffff/* flags reported by reflection */
+
+#define ACC_CLASS_PRIMITIVE         0x00010000/* class is a primitive class   */
+
+#define ACC_CLASS_HAS_POINTERS      0x00020000/* instance contains pointers   */
+
+#define ACC_CLASS_REFERENCE_MASK    0x001c0000
+#define ACC_CLASS_REFERENCE_SOFT    0x00040000
+#define ACC_CLASS_REFERENCE_WEAK    0x00080000
+#define ACC_CLASS_REFERENCE_PHANTOM 0x00100000
+
 
 /* special flags used in methodinfo *******************************************/
 
-#define ACC_METHOD_IMPLEMENTED 0x00010000     /* there is an implementation   */
-#define ACC_METHOD_MONOMORPHIC 0x00020000     /* currently monomorphic method */
+#define ACC_METHOD_BUILTIN     0x00010000     /* use for descriptor parsing   */
+#define ACC_METHOD_IMPLEMENTED 0x00020000     /* there is an implementation   */
+#define ACC_METHOD_MONOMORPHIC 0x00040000     /* currently monomorphic method */
 
 
 /* data structures of the runtime system **************************************/
@@ -217,13 +201,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
 };
 
@@ -236,20 +226,6 @@ struct java_objectheader {              /* header for all objects             */
        which is referenced by the vftbl.
 */
 
-/* CAUTION: Don't change the numerical values! These constants (with
- * the exception of ARRAYTYPE_OBJECT) are used as indices in the
- * primitive type table.
- */
-#define ARRAYTYPE_INT      PRIMITIVETYPE_INT
-#define ARRAYTYPE_LONG     PRIMITIVETYPE_LONG
-#define ARRAYTYPE_FLOAT    PRIMITIVETYPE_FLOAT
-#define ARRAYTYPE_DOUBLE   PRIMITIVETYPE_DOUBLE
-#define ARRAYTYPE_BYTE     PRIMITIVETYPE_BYTE
-#define ARRAYTYPE_CHAR     PRIMITIVETYPE_CHAR
-#define ARRAYTYPE_SHORT    PRIMITIVETYPE_SHORT
-#define ARRAYTYPE_BOOLEAN  PRIMITIVETYPE_BOOLEAN
-#define ARRAYTYPE_OBJECT   PRIMITIVETYPE_VOID     /* don't use as index! */
-
 typedef struct java_arrayheader {       /* header for all arrays              */
        java_objectheader objheader;        /* object header                      */
        s4 size;                            /* array size                         */
@@ -311,14 +287,6 @@ struct java_objectarray {
 };
 
 
-/* Synchronization ************************************************************/
-
-#if defined(ENABLE_THREADS)
-void compiler_lock();
-void compiler_unlock();
-#endif
-
-
 /* global constants related to the verifier ***********************************/
 
 /* The verifier needs additional variables in the variable array. Since these */