aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/Class.h
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>2001-12-15 08:31:49 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2001-12-15 08:31:49 +0000
commit861ef92859ce3681ae24ecac1384e0be2a035c9d (patch)
treea15d17366ad109cb78a0bc4f4aaf8e142550387d /libjava/java/lang/Class.h
parented86a83d510ad44be77328cf80b1e6198f992c7c (diff)
downloadgcc-861ef92859ce3681ae24ecac1384e0be2a035c9d.zip
gcc-861ef92859ce3681ae24ecac1384e0be2a035c9d.tar.gz
gcc-861ef92859ce3681ae24ecac1384e0be2a035c9d.tar.bz2
java-tree.h (otable_methods, [...]): New field/global tree definitions.
gcc/java: * java-tree.h (otable_methods, otable_decl, otable_syms_decl, otable_type, otable_ptr_type, method_symbol_type, method_symbols_array_type, method_symbols_array_ptr_type): New field/global tree definitions. (flag_indirect_dispatch): New flag. * decl.c (java_init_decl_processing): Initialize new otable and otable_syms type nodes and decls. Add new field "index" to method_type_node. * class.c (build_method_symbols_entry): New function. (make_method_value): Set "index" to to method's vtable index for virtual methods when indirect-dispatch is not used. (make_class_data): For indirect-dispatch, dont emit the dtable_decl, and set vtable_method_count to -1. Set otable and otable_syms field if indirect-dispatch is used and there was something to put in them. (build_method_symbols_entry): New function. (emit_offset_symbol_table): New function. * expr.c (get_offset_table_index): New function. (build_invokevirtual): Build array reference to otable at the index returned by get_offset_table_index, and use the result as the vtable offset. (build_invokeinterface): Similar. * jcf-parse.c (yyparse): If indirect-dispatch, call emit_offset_symbol_table at the end of compilation, after all classes have been generated. * jvspec.c: Don't pass findirect-dispatch to jvgenmain. * lang.c (flag_indirect_dispatch): Define. (lang_f_options): Add indirect-dispatch flag. libjava: * include/jvm.h (_Jv_VTable::idx_to_offset): New method. * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_MakeVTable and _Jv_LinkOffsetTable if needed. * java/lang/Class.h (_Jv_Method): Add "index" field. (_Jv_MethodSymbol): New struct type. (_Jv_LinkOffsetTable, _Jv_LayoutVTableMethods, _Jv_SetVTableEntries, _Jv_MakeVTable): Friends. (otable, otable_syms): New Class fields. * java/lang/natClass.cc (_Jv_LinkOffsetTable): New function. (isVirtualMethod): New static function. (_Jv_LayoutVTableMethods): New function. (_Jv_SetVTableEntries): New function. (_Jv_MakeVTable): New function. From-SVN: r48038
Diffstat (limited to 'libjava/java/lang/Class.h')
-rw-r--r--libjava/java/lang/Class.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index aac5f12..2052391 100644
--- a/libjava/java/lang/Class.h
+++ b/libjava/java/lang/Class.h
@@ -70,6 +70,8 @@ struct _Jv_Method
_Jv_Utf8Const *signature;
// Access flags.
_Jv_ushort accflags;
+ // Method's index in the vtable.
+ _Jv_ushort index;
// Pointer to underlying function.
void *ncode;
// NULL-terminated list of exception class names; can be NULL if
@@ -114,6 +116,19 @@ union _Jv_Self
jclass self;
};
+struct _Jv_MethodSymbol
+{
+ _Jv_Utf8Const *class_name;
+ _Jv_Utf8Const *name;
+ _Jv_Utf8Const *signature;
+};
+
+struct _Jv_OffsetTable
+{
+ jint state;
+ jint offsets[];
+};
+
#define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1)
#define JV_CLASS(Obj) ((jclass) (*(_Jv_VTable **) Obj)->clas)
@@ -303,6 +318,10 @@ private:
friend jstring _Jv_GetMethodString(jclass, _Jv_Utf8Const *);
friend jshort _Jv_AppendPartialITable (jclass, jclass, void **, jshort);
friend jshort _Jv_FindIIndex (jclass *, jshort *, jshort);
+ friend void _Jv_LinkOffsetTable (jclass);
+ friend void _Jv_LayoutVTableMethods (jclass klass);
+ friend void _Jv_SetVTableEntries (jclass, _Jv_VTable *);
+ friend void _Jv_MakeVTable (jclass);
// Return array class corresponding to element type KLASS, creating it if
// necessary.
@@ -367,6 +386,10 @@ private:
jshort static_field_count;
// The vtbl for all objects of this class.
_Jv_VTable *vtable;
+ // Virtual method offset table.
+ _Jv_OffsetTable *otable;
+ // Offset table symbols.
+ _Jv_MethodSymbol *otable_syms;
// Interfaces implemented by this class.
jclass *interfaces;
// The class loader for this class.