aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/lang.c
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>2001-12-15 08:31:49 +0000
committerBryce McKinlay <bryce@waitaki.otago.ac.nz>2001-12-15 08:31:49 +0000
commit090564a63d08fbcc0358c321b21602ec4c7fd2b2 (patch)
treea15d17366ad109cb78a0bc4f4aaf8e142550387d /gcc/java/lang.c
parent8c2bf0e36b51fe679915dfc0c248e539778e7be1 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@48038 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r--gcc/java/lang.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index c07c5868017..11e036ca38a 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -153,6 +153,10 @@ int flag_force_classes_archive_check;
be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead. */
int flag_optimize_sci = 1;
+/* When non zero, use offset tables for virtual method calls
+ in order to improve binary compatibility. */
+int flag_indirect_dispatch = 0;
+
/* When non zero, print extra version information. */
static int version_flag = 0;
@@ -174,7 +178,8 @@ lang_f_options[] =
{"jni", &flag_jni, 1},
{"check-references", &flag_check_references, 1},
{"force-classes-archive-check", &flag_force_classes_archive_check, 1},
- {"optimize-static-class-initialization", &flag_optimize_sci, 1 }
+ {"optimize-static-class-initialization", &flag_optimize_sci, 1 },
+ {"indirect-dispatch", &flag_indirect_dispatch, 1}
};
static struct string_option