diff options
author | Bryce McKinlay <bryce@waitaki.otago.ac.nz> | 2001-12-15 08:31:49 +0000 |
---|---|---|
committer | Bryce McKinlay <bryce@gcc.gnu.org> | 2001-12-15 08:31:49 +0000 |
commit | 861ef92859ce3681ae24ecac1384e0be2a035c9d (patch) | |
tree | a15d17366ad109cb78a0bc4f4aaf8e142550387d /gcc/java/java-tree.h | |
parent | ed86a83d510ad44be77328cf80b1e6198f992c7c (diff) | |
download | gcc-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 'gcc/java/java-tree.h')
-rw-r--r-- | gcc/java/java-tree.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 9d11bf6..17a0638 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -141,6 +141,18 @@ extern int compiling_from_source; /* List of all class filenames seen so far. */ #define all_class_filename java_global_trees [JTI_ALL_CLASS_FILENAME] +/* List of virtual method decls called in this translation unit, used to + generate virtual method offset symbol table. */ +#define otable_methods java_global_trees [JTI_OTABLE_METHODS] + +/* The virtual method offset table. This is emitted as uninitialized data of + the required length, and filled out at run time during class linking. */ +#define otable_decl java_global_trees [JTI_OTABLE_DECL] + +/* The virtual method offset symbol table. Used by the runtime to fill out the + otable. */ +#define otable_syms_decl java_global_trees [JTI_OTABLE_SYMS_DECL] + extern int flag_emit_class_files; extern int flag_filelist_file; @@ -196,6 +208,10 @@ extern int flag_check_references; initialization optimization should be performed. */ extern int flag_optimize_sci; +/* When non zero, use offset tables for virtual method calls + in order to improve binary compatibility. */ +extern int flag_indirect_dispatch; + /* Encoding used for source files. */ extern const char *current_encoding; @@ -331,6 +347,11 @@ enum java_tree_index JTI_LINENUMBERS_TYPE, JTI_METHOD_TYPE_NODE, JTI_METHOD_PTR_TYPE_NODE, + JTI_OTABLE_TYPE, + JTI_OTABLE_PTR_TYPE, + JTI_METHOD_SYMBOL_TYPE, + JTI_METHOD_SYMBOLS_ARRAY_TYPE, + JTI_METHOD_SYMBOLS_ARRAY_PTR_TYPE, JTI_END_PARAMS_NODE, @@ -370,6 +391,10 @@ enum java_tree_index JTI_ALL_CLASS_LIST, JTI_ALL_CLASS_FILENAME, + JTI_OTABLE_METHODS, + JTI_OTABLE_DECL, + JTI_OTABLE_SYMS_DECL, + JTI_MAX }; @@ -565,6 +590,16 @@ extern tree java_global_trees[JTI_MAX]; java_global_trees[JTI_METHOD_TYPE_NODE] #define method_ptr_type_node \ java_global_trees[JTI_METHOD_PTR_TYPE_NODE] +#define otable_type \ + java_global_trees[JTI_OTABLE_TYPE] +#define otable_ptr_type \ + java_global_trees[JTI_OTABLE_PTR_TYPE] +#define method_symbol_type \ + java_global_trees[JTI_METHOD_SYMBOL_TYPE] +#define method_symbols_array_type \ + java_global_trees[JTI_METHOD_SYMBOLS_ARRAY_TYPE] +#define method_symbols_array_ptr_type \ + java_global_trees[JTI_METHOD_SYMBOLS_ARRAY_PTR_TYPE] #define end_params_node \ java_global_trees[JTI_END_PARAMS_NODE] @@ -1098,6 +1133,7 @@ extern void make_class_data PARAMS ((tree)); extern void register_class PARAMS ((void)); extern int alloc_name_constant PARAMS ((int, tree)); extern void emit_register_classes PARAMS ((void)); +extern void emit_offset_symbol_table PARAMS ((void)); extern void lang_init_source PARAMS ((int)); extern void write_classfile PARAMS ((tree)); extern char *print_int_node PARAMS ((tree)); |