diff options
author | Andrew Haley <aph@redhat.com> | 2004-01-09 17:08:44 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2004-01-09 17:08:44 +0000 |
commit | 85194ee94ae7aea48bf25631aeba8b89f0f0d7d8 (patch) | |
tree | 98aa4fb08cdfb195718477b393ddac9e38551240 /gcc/java/constants.c | |
parent | 900a35c82b8dd470433ac7b52e3187b05b7988c9 (diff) | |
download | gcc-85194ee94ae7aea48bf25631aeba8b89f0f0d7d8.zip gcc-85194ee94ae7aea48bf25631aeba8b89f0f0d7d8.tar.gz gcc-85194ee94ae7aea48bf25631aeba8b89f0f0d7d8.tar.bz2 |
re PR java/12755 (Binary Compatibility: Resolving static methods and classes is not thread safe)
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.
From-SVN: r75590
Diffstat (limited to 'gcc/java/constants.c')
-rw-r--r-- | gcc/java/constants.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/java/constants.c b/gcc/java/constants.c index 8a1fe1b..d97e8c0 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -1,5 +1,5 @@ /* Handle the constant pool of the Java(TM) Virtual Machine. - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -351,7 +351,7 @@ cpool_for_class (tree class) int alloc_name_constant (int tag, tree name) { - CPool *outgoing_cpool = cpool_for_class (current_class); + CPool *outgoing_cpool = cpool_for_class (output_class); return find_tree_constant (outgoing_cpool, tag, name); } @@ -393,19 +393,19 @@ build_constant_data_ref (void) { tree cpool_data_ref = NULL_TREE; - if (TYPE_CPOOL_DATA_REF (current_class)) - cpool_data_ref = TYPE_CPOOL_DATA_REF (current_class); + if (TYPE_CPOOL_DATA_REF (output_class)) + cpool_data_ref = TYPE_CPOOL_DATA_REF (output_class); if (cpool_data_ref == NULL_TREE) { tree decl; - tree decl_name = mangled_classname ("_CD_", current_class); + tree decl_name = mangled_classname ("_CD_", output_class); decl = build_decl (VAR_DECL, decl_name, build_array_type (ptr_type_node, one_elt_array_domain_type)); TREE_STATIC (decl) = 1; make_decl_rtl (decl, NULL); - TYPE_CPOOL_DATA_REF (current_class) = cpool_data_ref + TYPE_CPOOL_DATA_REF (output_class) = cpool_data_ref = build1 (ADDR_EXPR, ptr_type_node, decl); } return cpool_data_ref; |