diff options
Diffstat (limited to 'libjava/include/jvm.h')
-rw-r--r-- | libjava/include/jvm.h | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 936d4c690c6..957869ee581 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -27,10 +27,35 @@ details. */ /* Structure of the virtual table. */ struct _Jv_VTable { +#ifdef __ia64__ jclass clas; + unsigned long : 64; void *gc_descr; - void *method[1]; - void *get_finalizer() { return method[0]; } + unsigned long : 64; + + typedef struct { void *pc, *gp; } vtable_elt; +#else + jclass clas; + void *gc_descr; + + typedef void *vtable_elt; +#endif + + // This must be last, as derived classes "extend" this by + // adding new data members. + vtable_elt method[1]; + +#ifdef __ia64__ + void *get_method(int i) { return &method[i]; } + void set_method(int i, void *fptr) { method[i] = *(vtable_elt *)fptr; } +#else + void *get_method(int i) { return method[i]; } + void set_method(int i, void *fptr) { method[i] = fptr; } +#endif + + void *get_finalizer() { return get_method(0); } + static size_t vtable_elt_size() { return sizeof(vtable_elt); } + static _Jv_VTable *new_vtable (int count); }; // Number of virtual methods on object. FIXME: it sucks that we have @@ -38,12 +63,9 @@ struct _Jv_VTable #define NUM_OBJECT_METHODS 5 // This structure is the type of an array's vtable. -struct _Jv_ArrayVTable +struct _Jv_ArrayVTable : public _Jv_VTable { - jclass clas; - void *gc_descr; - void *method[NUM_OBJECT_METHODS]; - void *get_finalizer() { return method[0]; } + vtable_elt extra_method[NUM_OBJECT_METHODS - 1]; }; union _Jv_word @@ -172,6 +194,18 @@ extern "C" void JvRunMain (jclass klass, int argc, const char **argv); void _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, bool is_jar); +// Delayed until after _Jv_AllocBytes is declared. +// +// Note that we allocate this as unscanned memory -- the vtables +// are handled specially by the GC. + +inline _Jv_VTable * +_Jv_VTable::new_vtable (int count) +{ + size_t size = sizeof(_Jv_VTable) + (count - 1) * vtable_elt_size (); + return (_Jv_VTable *) _Jv_AllocBytes (size); +} + // This function is used to determine the hash code of an object. inline jint _Jv_HashCode (jobject obj) |