diff options
author | Richard Henderson <rth@gcc.gnu.org> | 2005-05-25 15:08:31 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-05-25 15:08:31 -0700 |
commit | 6de33afa78e19bee96963ec3771c352a488287e1 (patch) | |
tree | 047bbcbef9a1b2d83cf20f62170c7df12ca50eff /gcc/java/class.c | |
parent | 81fc305201e8913727cb61303c4812730a95c59c (diff) | |
download | gcc-6de33afa78e19bee96963ec3771c352a488287e1.zip gcc-6de33afa78e19bee96963ec3771c352a488287e1.tar.gz gcc-6de33afa78e19bee96963ec3771c352a488287e1.tar.bz2 |
re PR libgcj/21692 (unexpected java.lang.NoClassDefFoundError)
PR libgcj/21692
cp/
* cp-tree.h (make_alias_for): Declare.
* decl2.c (build_java_method_aliases): New.
(cp_finish_file): Call it.
* method.c (make_alias_for): Split out from ...
(make_alias_for_thunk): ... here.
java/
* Make-lang.in (java/mangle.o): Depend on LANGHOOKS_DEF_H.
* class.c (build_class_ref): Set DECL_CLASS_FIELD_P and
DECL_CONTEXT; avoid pushdecl_top_level.
(build_dtable_decl): Set DECL_VTABLE_P and DECL_CONTEXT.
(layout_class): Don't SET_DECL_ASSEMBLER_NAME.
(layout_class_method): Likewise.
* decl.c (java_mark_cni_decl_local): New.
(java_mark_class_local): Use it.
* java-tree.h (DECL_LOCAL_CNI_METHOD_P): New.
(DECL_CLASS_FIELD_P, DECL_VTABLE_P): New.
(struct lang_decl_func): Add local_cni;
(struct lang_decl_var): Add class_field, vtable.
(java_mangle_decl): Declare.
* lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): New.
* mangle.c: Remove dup obstack.h; include langhooks-def.h.
(mangle_obstack_1): New.
(java_mangle_decl): Remove obstack argument. Call mangle_class_field,
mangle_vtable, and mangle_local_cni_method_decl. Fall back to
lhd_set_decl_assembler_name for things that don't need mangling.
(mangle_class_field): Rename from java_mangle_class_field, make
static, don't call init_mangling or finish_mangling.
(mangle_vtable): Similarly.
(mangle_local_cni_method_decl): New.
(init_mangling): Remove obstack argument. Use &mangle_obstack_1,
gcc_assert, and MANGLE_RAW_STRING.
(finish_mangling): Use gcc_assert, remove if 0 debugging code.
From-SVN: r100171
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r-- | gcc/java/class.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c index 3e8ae26..88ca1f4 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -970,10 +970,13 @@ build_class_ref (tree type) DECL_ARTIFICIAL (decl) = 1; if (is_compiled == 1) DECL_EXTERNAL (decl) = 1; - SET_DECL_ASSEMBLER_NAME (decl, - java_mangle_class_field - (&temporary_obstack, type)); - pushdecl_top_level (decl); + MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); + DECL_CLASS_FIELD_P (decl) = 1; + DECL_CONTEXT (decl) = type; + + /* ??? We want to preserve the DECL_CONTEXT we set just above, + that that means not calling pushdecl_top_level. */ + IDENTIFIER_GLOBAL_VALUE (decl_name) = decl; } } else @@ -1969,7 +1972,7 @@ is_compiled_class (tree class) tree build_dtable_decl (tree type) { - tree dtype; + tree dtype, decl; /* We need to build a new dtable type so that its size is uniquely computed when we're dealing with the class for real and not just @@ -2017,8 +2020,12 @@ build_dtable_decl (tree type) else dtype = dtable_type; - return build_decl (VAR_DECL, - java_mangle_vtable (&temporary_obstack, type), dtype); + decl = build_decl (VAR_DECL, get_identifier ("vt$"), dtype); + DECL_CONTEXT (decl) = type; + MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); + DECL_VTABLE_P (decl) = 1; + + return decl; } /* Pre-pend the TYPE_FIELDS of THIS_CLASS with a dummy FIELD_DECL for the @@ -2092,7 +2099,6 @@ void layout_class (tree this_class) { tree super_class = CLASSTYPE_SUPER (this_class); - tree field; class_list = tree_cons (this_class, NULL_TREE, class_list); if (CLASS_BEING_LAIDOUT (this_class)) @@ -2140,18 +2146,6 @@ layout_class (tree this_class) push_super_field (this_class, maybe_super_class); } - for (field = TYPE_FIELDS (this_class); - field != NULL_TREE; field = TREE_CHAIN (field)) - { - if (FIELD_STATIC (field)) - { - /* Set DECL_ASSEMBLER_NAME to something suitably mangled. */ - SET_DECL_ASSEMBLER_NAME (field, - java_mangle_decl - (&temporary_obstack, field)); - } - } - layout_type (this_class); /* Also recursively load/layout any superinterfaces, but only if @@ -2319,11 +2313,6 @@ layout_class_method (tree this_class, tree super_class, compiled into this object file. */ DECL_EXTERNAL (method_decl) = 1; - /* This is a good occasion to mangle the method's name */ - SET_DECL_ASSEMBLER_NAME (method_decl, - java_mangle_decl (&temporary_obstack, - method_decl)); - if (ID_INIT_P (method_name)) { const char *p = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (this_class))); |