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/jcf-parse.c | |
parent | 843505b2f08e637f8089132b4d8c4aad513f6b8f (diff) | |
download | gcc-757f6c6c12a8ce0b42a6ac1f27df9c99da15947d.tar.gz |
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/jcf-parse.c')
-rw-r--r-- | gcc/java/jcf-parse.c | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index a3fa2124f82..32140920676 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1,5 +1,5 @@ /* Parser for Java(TM) .class files. - Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -72,10 +72,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ extern struct obstack temporary_obstack; -/* Set to nonzero value in order to emit class initialization code - before static field references. */ -extern int always_initialize_class_p; - static GTY(()) tree parse_roots[3]; /* The FIELD_DECL for the current field. */ @@ -153,7 +149,7 @@ set_source_filename (JCF *jcf, int index) #define HANDLE_CLASS_INFO(ACCESS_FLAGS, THIS, SUPER, INTERFACES_COUNT) \ { tree super_class = SUPER==0 ? NULL_TREE : get_class_constant (jcf, SUPER); \ - current_class = give_name_to_class (jcf, THIS); \ + output_class = current_class = give_name_to_class (jcf, THIS); \ set_super_info (ACCESS_FLAGS, current_class, super_class, INTERFACES_COUNT);} #define HANDLE_CLASS_INTERFACE(INDEX) \ @@ -509,7 +505,7 @@ read_class (tree name) wfl_operator = build_expr_wfl (NULL_TREE, NULL, 0, 0); EXPR_WFL_FILENAME_NODE (wfl_operator) = file; input_filename = ggc_strdup (filename); - current_class = NULL_TREE; + output_class = current_class = NULL_TREE; current_function_decl = NULL_TREE; if (!HAS_BEEN_ALREADY_PARSED_P (file)) { @@ -531,7 +527,7 @@ read_class (tree name) { java_parser_context_save_global (); java_push_parser_context (); - current_class = class; + output_class = current_class = class; input_filename = current_jcf->filename; if (JCF_SEEN_IN_ZIP (current_jcf)) read_zip_member(current_jcf, @@ -549,7 +545,7 @@ read_class (tree name) load_inner_classes (class); } - current_class = save_current_class; + output_class = current_class = save_current_class; input_location = save_location; current_jcf = save_current_jcf; return 1; @@ -709,6 +705,8 @@ parse_class_file (void) compiling from class files. */ always_initialize_class_p = 1; + gen_indirect_dispatch_tables (current_class); + java_mark_class_local (current_class); for (method = TYPE_METHODS (current_class); @@ -1099,7 +1097,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) input_filename = IDENTIFIER_POINTER (TREE_VALUE (node)); if (CLASS_FILE_P (node)) { - current_class = TREE_PURPOSE (node); + output_class = current_class = TREE_PURPOSE (node); current_jcf = TYPE_JCF (current_class); layout_class (current_class); load_inner_classes (current_class); @@ -1119,18 +1117,6 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) /* Emit the .jcf section. */ emit_register_classes (); - if (flag_indirect_dispatch) - { - otable_decl - = emit_symbol_table - (get_identifier ("otable"), - otable_decl, otable_methods, otable_syms_decl, integer_type_node); - atable_decl - = emit_symbol_table - (get_identifier ("atable"), - atable_decl, atable_methods, atable_syms_decl, ptr_type_node); - } - emit_catch_table (); } write_resource_constructor (); @@ -1201,7 +1187,7 @@ parse_zip_file_entries (void) class = lookup_class (get_identifier (class_name)); FREE (class_name); current_jcf = TYPE_JCF (class); - current_class = class; + output_class = current_class = class; if (! CLASS_LOADED_P (class)) { |