diff options
| author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-09 17:08:44 +0000 |
|---|---|---|
| committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-09 17:08:44 +0000 |
| commit | 757f6c6c12a8ce0b42a6ac1f27df9c99da15947d (patch) | |
| tree | 98aa4fb08cdfb195718477b393ddac9e38551240 /gcc/java/lang.c | |
| parent | 843505b2f08e637f8089132b4d8c4aad513f6b8f (diff) | |
| download | ppe42-gcc-757f6c6c12a8ce0b42a6ac1f27df9c99da15947d.tar.gz ppe42-gcc-757f6c6c12a8ce0b42a6ac1f27df9c99da15947d.zip | |
2004-01-09 Andrew Haley <aph@redhat.com>
PR java/12755:
* parse.y (java_fix_constructors): Set output_class.
(java_reorder_fields): Likewise.
(java_layout_classes): Likewise.
(java_expand_classes): Generate indirect dispatch tables.
(java_expand_classes): Set output_class.
(java_finish_classes): Likewise.
* lang.c (java_init): Turn on always_initialize_class_p if we're
using indirect dis[atch.
(java_decl_ok_for_sibcall): Use output_class, not current_class.
(java_get_callee_fndecl): Use class local atable.
* jcf-parse.c
(always_initialize_class_p): Decl moved to java-tree.h.
(HANDLE_CLASS_INFO): Set output_class.
(read_class): Likewise.
(parse_class_file): Call gen_indirect_dispatch_tables.
(parse_zip_file_entries): Set output_class.
(java_parse_file): Set output_class. Don't emit symbol tables.
* java-tree.h (output_class): New.
Remove global declarations for otable, atable, and ctable.
(always_initialize_class_p): moved here from decl.c.
(DECL_OWNER): New.
(TYPE_ATABLE_METHODS, TYPE_ATABLE_SYMS_DECL, TYPE_ATABLE_DECL,
TYPE_OTABLE_METHODS, TYPE_OTABLE_SYMS_DECL, TYPE_OTABLE_DECL,
TYPE_CTABLE_DECL, TYPE_CATCH_CLASSES): New.
(struct lang_type): Add otable_methods, otable_decl,
otable_syms_decl, atable_methods, atable_decl, atable_syms_decl,
ctable_decl, catch_classes, type_to_runtime_map.
* expr.c (build_field_ref): Make otable, atable, and ctable class
local rather than global.
(build_known_method_ref): Likewise.
(build_invokeinterface): Likewise.
(java_expand_expr): Pass runtime type (rather than actual type) to
expand_start_catch.
* except.c (prepare_eh_table_type): Create TYPE_TO_RUNTIME_MAP for
this class. Look up each class in that map to delete duplicates.
(expand_end_java_handler): Pass runtime type (rather than actual
type) to expand_start_catch.
* decl.c: (always_initialize_class_p): Decl moved to java-tree.h.
(do_nothing): New.
(java_init_decl_processing): Rearrange things. Remove global
declarations of otable, atable, and ctable.
(java_init_decl_processing): Make lang_eh_runtime_type do_nothing.
(java_expand_body): Set output_class.
* constants.c (build_constant_data_ref): Use output_class, not
current_class.
(alloc_name_constant): Likewise.
* class.c (gen_indirect_dispatch_tables): New.
(build_class_ref): Generate hard reference to superclass, even if
using indirect dispatch.
(build_static_field_ref): Use class local atable.
(make_class_data): Generate hard reference to superclass, even if
using indirect dispatch.
Generate symbolic references to interfaces when using indirect
dispatch.
(make_class_data): Emit otable, atable, and ctable.
Make otable, atable, and ctable class local rather than global.
(emit_catch_table): Make otable, atable, and ctable class local
rather than global.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75590 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/lang.c')
| -rw-r--r-- | gcc/java/lang.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c index c2494daacea..2f68f7c0453 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -1,5 +1,5 @@ /* Java(TM) language-specific utility routines. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -464,6 +464,11 @@ java_init (void) if (flag_inline_functions) flag_inline_trees = 1; + /* FIXME: Indirect dispatch isn't yet compatible with static class + init optimization. */ + if (flag_indirect_dispatch) + always_initialize_class_p = true; + /* Force minimum function alignment if g++ uses the least significant bit of function pointers to store the virtual bit. This is required to keep vtables compatible. */ @@ -967,11 +972,9 @@ inline_init_test_initialization (void **entry, void *x) (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key); if (! h) return true; - splay_tree_insert (decl_map, (splay_tree_key) ite->value, (splay_tree_value) h); - return true; } @@ -1102,7 +1105,7 @@ java_dump_tree (void *dump_info, tree t) static bool java_decl_ok_for_sibcall (tree decl) { - return decl != NULL && DECL_CONTEXT (decl) == current_class; + return decl != NULL && DECL_CONTEXT (decl) == output_class; } /* Used by estimate_num_insns. Estimate number of instructions seen @@ -1228,7 +1231,7 @@ java_start_inlining (tree fn) static tree java_get_callee_fndecl (tree call_expr) { - tree method, table, element; + tree method, table, element, atable_methods; HOST_WIDE_INT index; @@ -1239,10 +1242,14 @@ java_get_callee_fndecl (tree call_expr) if (TREE_CODE (method) != ARRAY_REF) return NULL; table = TREE_OPERAND (method, 0); - if (table != atable_decl) + if (! DECL_LANG_SPECIFIC(table) + || !DECL_OWNER (table) + || TYPE_ATABLE_DECL (DECL_OWNER (table)) != table) return NULL; - index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1)); + atable_methods = TYPE_ATABLE_METHODS (DECL_OWNER (table)); + index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1)); + /* FIXME: Replace this for loop with a hash table lookup. */ for (element = atable_methods; element; element = TREE_CHAIN (element)) { @@ -1257,7 +1264,7 @@ java_get_callee_fndecl (tree call_expr) } --index; } - + return NULL; } |

