/* src/vm/global.h - global definitions
- 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
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
#define _GLOBAL_H
#include "config.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+
#include "vm/types.h"
/* additional data types ******************************************************/
-typedef void *voidptr; /* generic pointer */
typedef void (*functionptr) (void); /* generic function pointer */
typedef u1* methodptr;
-typedef unsigned int bool; /* boolean data type */
-
-#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 */
#define ALIGN_2(a) ALIGN_EVEN(a)
+/* printf format defines ******************************************************/
+
+/* Define printf formats which change size between 32- and 64-bit. */
+
+#if SIZEOF_VOID_P == 8
+# define PRINTF_FORMAT_INTPTR_T "0x%016lx"
+# define PRINTF_FORMAT_INT64_T "%ld"
+#else
+# define PRINTF_FORMAT_INTPTR_T "0x%08lx"
+# define PRINTF_FORMAT_INT64_T "%lld"
+#endif
+
+
+/* convenience macros *********************************************************/
+
+/* Makes a string of the argument (which is not macro-expanded). */
+
+#define STR(a) #a
+
+/* There are multiple definitions of MIN out there, but we cannot be sure. */
+
+#ifndef MIN
+# define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef MAX
+# define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+
/* forward typedefs ***********************************************************/
typedef struct java_object_t java_object_t;
#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 */
+#define ACC_METHOD_EA 0x00080000 /* method being escape analyzed */
+#define ACC_METHOD_MONOMORPHY_USED \
+ 0x00100000
+#define ACC_METHOD_PARENT_MONOMORPHY_USED \
+ 0x00200000
/* data structures of the runtime system **************************************/
*******************************************************************************/
-#define HDRFLAG_FLC 0x01
#define HDRFLAG_MARK1 0x02
#define HDRFLAG_MARK2 0x04
#define HDRFLAG_UNCOLLECTABLE 0x08
#define HDRFLAG_HASH_ATTACHED 0x20
#define HDRFLAG_REFERENCING 0x40
+#include "threads/lockword.hpp"
+
struct java_object_t { /* header for all objects */
- struct _vftbl *vftbl; /* pointer to virtual function table */
+ struct _vftbl *vftbl; /* pointer to virtual function table */
#if defined(ENABLE_THREADS)
- struct lock_record_t *monitorPtr;
+ Lockword lockword;
#endif
-#if defined(ENABLE_THREADS) || defined(ENABLE_GC_CACAO)
- ptrint hdrflags; /* word containing the FLC and GC bits */
+#if defined(ENABLE_GC_CACAO)
+ uintptr_t hdrflags; /* word containing the GC bits */
+#endif
+#if defined(ENABLE_ESCAPE_CHECK)
+ void *method;
+ void *thread;
+ uintptr_t escape;
#endif
};
*******************************************************************************/
-#if defined(ENABLE_HANDLES)
-typedef struct java_handle_t {
- java_object_t *heap_object;
-} java_handle_t;
-
-typedef struct java_handle_objectarray_t { java_objectarray_t *heap_object; } java_handle_objectarray_t;
-typedef struct java_handle_booleanarray_t { java_booleanarray_t *heap_object; } java_handle_booleanarray_t;
-typedef struct java_handle_bytearray_t { java_bytearray_t *heap_object; } java_handle_bytearray_t;
-typedef struct java_handle_chararray_t { java_chararray_t *heap_object; } java_handle_chararray_t;
-typedef struct java_handle_shortarray_t { java_shortarray_t *heap_object; } java_handle_shortarray_t;
-typedef struct java_handle_intarray_t { java_intarray_t *heap_object; } java_handle_intarray_t;
-typedef struct java_handle_longarray_t { java_longarray_t *heap_object; } java_handle_longarray_t;
-typedef struct java_handle_floatarray_t { java_floatarray_t *heap_object; } java_handle_floatarray_t;
-typedef struct java_handle_doublearray_t { java_doublearray_t *heap_object; } java_handle_doublearray_t;
-#else
typedef java_object_t java_handle_t;
-typedef java_objectarray_t java_handle_objectarray_t;
-typedef java_booleanarray_t java_handle_booleanarray_t;
-typedef java_bytearray_t java_handle_bytearray_t;
-typedef java_chararray_t java_handle_chararray_t;
-typedef java_shortarray_t java_handle_shortarray_t;
-typedef java_intarray_t java_handle_intarray_t;
-typedef java_longarray_t java_handle_longarray_t;
-typedef java_floatarray_t java_handle_floatarray_t;
-typedef java_doublearray_t java_handle_doublearray_t;
-#endif
+typedef java_handle_t java_handle_array_t;
+typedef java_handle_array_t java_handle_objectarray_t;
+typedef java_handle_array_t java_handle_booleanarray_t;
+typedef java_handle_array_t java_handle_bytearray_t;
+typedef java_handle_array_t java_handle_chararray_t;
+typedef java_handle_array_t java_handle_shortarray_t;
+typedef java_handle_array_t java_handle_intarray_t;
+typedef java_handle_array_t java_handle_longarray_t;
+typedef java_handle_array_t java_handle_floatarray_t;
+typedef java_handle_array_t java_handle_doublearray_t;
/* global constants related to the verifier ***********************************/