diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2000-06-03 00:46:44 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2000-06-02 17:46:44 -0700 |
commit | 8f975c18ed141fa8c40ad7b19c9e57f95ed26b36 (patch) | |
tree | d18797b287bb05dc755688b57c7f7921f0329539 | |
parent | 2e761e491932350e080453897ae449040a102897 (diff) | |
download | gcc-8f975c18ed141fa8c40ad7b19c9e57f95ed26b36.zip gcc-8f975c18ed141fa8c40ad7b19c9e57f95ed26b36.tar.gz gcc-8f975c18ed141fa8c40ad7b19c9e57f95ed26b36.tar.bz2 |
class.c (get_dispatch_table): Build the vtable dummy entry list element with a null purpose.
Fri Jun 2 16:48:55 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (get_dispatch_table): Build the vtable dummy entry list
element with a null purpose. Fixed leading comment.
(build_dtable_decl): Build an accurate dtable type when appropriate
and use it.
From-SVN: r34369
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/class.c | 29 |
2 files changed, 32 insertions, 4 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index aefe16d..ff312a12 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 2 16:48:55 2000 Alexandre Petit-Bianco <apbianco@cygnus.com> + + * class.c (get_dispatch_table): Build the vtable dummy entry list + element with a null purpose. Fixed leading comment. + (build_dtable_decl): Build an accurate dtable type when appropriate + and use it. + 2000-06-02 Richard Henderson <rth@cygnus.com> * lang.c (lang_get_alias_set): New. diff --git a/gcc/java/class.c b/gcc/java/class.c index dcc5448..dc5d16a 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1229,8 +1229,9 @@ get_dispatch_table (type, this_class_addr) } /* Dummy entry for compatibility with G++ -fvtable-thunks. When using the Boehm GC we sometimes stash a GC type descriptor - there. */ - list = tree_cons (integer_zero_node, get_boehm_type_descriptor (type), + there. We set the PURPOSE to NULL_TREE not to interfere (reset) + the emitted byte count during the output to the assembly file. */ + list = tree_cons (NULL_TREE, get_boehm_type_descriptor (type), list); list = tree_cons (integer_zero_node, this_class_addr, list); return build (CONSTRUCTOR, build_prim_array_type (nativecode_ptr_type_node, @@ -1673,13 +1674,33 @@ tree build_dtable_decl (type) tree type; { - tree name; + tree name, dtype; + + /* 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 + faking it (like java.lang.Class during the initialization of the + compiler.) We now we're not faking a class when CURRENT_CLASS is + TYPE. */ + if (current_class == type) + { + tree dummy, aomt, n; + + dtype = make_node (RECORD_TYPE); + PUSH_FIELD (dtype, dummy, "class", class_ptr_type); + n = build_int_2 (TREE_VEC_LENGTH (get_dispatch_vector (type)), 0); + aomt = build_array_type (ptr_type_node, build_index_type (n)); + PUSH_FIELD (dtype, dummy, "methods", aomt); + layout_type (dtype); + } + else + dtype = dtable_type; + obstack_grow (&temporary_obstack, "__vt_", 5); append_gpp_mangled_type (&temporary_obstack, type); obstack_1grow (&temporary_obstack, '\0'); name = get_identifier (obstack_base (&temporary_obstack)); obstack_free (&temporary_obstack, obstack_base (&temporary_obstack)); - return build_decl (VAR_DECL, name, dtable_type); + return build_decl (VAR_DECL, name, dtype); } /* Pre-pend the TYPE_FIELDS of THIS_CLASS with a dummy FIELD_DECL for the |