diff options
| author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-21 16:59:12 +0000 |
|---|---|---|
| committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-21 16:59:12 +0000 |
| commit | 67577e43ece0812b968fd949d8c890e880fc6668 (patch) | |
| tree | 8a0b15f8ae55ff04e4e9997580f5dcc5bbc78ec7 /libjava/include | |
| parent | 6bfa2cc1b1757ca919c796642fcb4ee2d7fe7fa7 (diff) | |
| download | ppe42-gcc-67577e43ece0812b968fd949d8c890e880fc6668.tar.gz ppe42-gcc-67577e43ece0812b968fd949d8c890e880fc6668.zip | |
* include/jvm.h (_Jv_VTable): Handle function descriptors for ia64;
add get_method, set_method, vtable_elt_size, new_vtable.
(_Jv_ArrayVTable): Derive from _Jv_VTable.
* resolve.cc (_Jv_PrepareClass): Use new _Jv_VTable methods.
* interpret.cc (_Jv_InterpMethod::continue1): Likewise.
* java/lang/natClassLoader.cc (_Jv_NewArrayClass): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45734 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/include')
| -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) |

