diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-09-22 18:12:10 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2004-09-22 18:12:10 +0000 |
commit | 942149531d595c7860a49a9688fd9cd160a62455 (patch) | |
tree | 3d48eaf3d5b695c2aed8d381f2851caa06e286d3 /gcc/cp | |
parent | 8739ed59c414cb398d6ffd6df489519700116d8a (diff) | |
download | gcc-942149531d595c7860a49a9688fd9cd160a62455.zip gcc-942149531d595c7860a49a9688fd9cd160a62455.tar.gz gcc-942149531d595c7860a49a9688fd9cd160a62455.tar.bz2 |
cp-tree.h (unemitted_tinfo_decls): Make a VEC(tree).
* cp-tree.h (unemitted_tinfo_decls): Make a VEC(tree).
* decl2.c (cp_finish_file): Adjust tinfo decl emission loop.
* rtti.c (unemitted_tinfo_decls): Make a VEC(tree).
(init_rtti_processing): Initialize it to something realistic.
(get_tinfo_decl): Adjust pushing the new decl.
From-SVN: r87872
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 37 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 11 |
4 files changed, 23 insertions, 35 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f88f663..e91d425 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2004-09-22 Nathan Sidwell <nathan@codesourcery.com> + * cp-tree.h (unemitted_tinfo_decls): Make a VEC(tree). + * decl2.c (cp_finish_file): Adjust tinfo decl emission loop. + * rtti.c (unemitted_tinfo_decls): Make a VEC(tree). + (init_rtti_processing): Initialize it to something realistic. + (get_tinfo_decl): Adjust pushing the new decl. + * cp-tree.h (struct lang_type_class): Remove marked flags, add diamond_shaped and repeated_base flags. Reorder to keep 8-bit blocks. (TYPE_MARKED_P): New. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 417d179..c439864 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3967,8 +3967,8 @@ extern bool repo_export_class_p (tree); extern void finish_repo (void); /* in rtti.c */ -/* A varray of all tinfo decls that haven't been emitted yet. */ -extern GTY(()) varray_type unemitted_tinfo_decls; +/* A vector of all tinfo decls that haven't been emitted yet. */ +extern GTY(()) VEC(tree) *unemitted_tinfo_decls; extern void init_rtti_processing (void); extern tree build_typeid (tree); diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0c05a7a..8506ea3 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2780,7 +2780,6 @@ cp_finish_file (void) do { tree t; - size_t n_old, n_new; reconsider = false; @@ -2823,32 +2822,16 @@ cp_finish_file (void) /* Write out needed type info variables. We have to be careful looping through unemitted decls, because emit_tinfo_decl may - cause other variables to be needed. We stick new elements - (and old elements that we may need to reconsider) at the end - of the array, then shift them back to the beginning once we're - done. */ - - n_old = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls); - for (i = 0; i < n_old; ++i) - { - tree tinfo_decl = VARRAY_TREE (unemitted_tinfo_decls, i); - if (emit_tinfo_decl (tinfo_decl)) - reconsider = true; - else - VARRAY_PUSH_TREE (unemitted_tinfo_decls, tinfo_decl); - } - - /* The only elements we want to keep are the new ones. Copy - them to the beginning of the array, then get rid of the - leftovers. */ - n_new = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) - n_old; - if (n_new) - memmove (&VARRAY_TREE (unemitted_tinfo_decls, 0), - &VARRAY_TREE (unemitted_tinfo_decls, n_old), - n_new * sizeof (tree)); - memset (&VARRAY_TREE (unemitted_tinfo_decls, n_new), - 0, n_old * sizeof (tree)); - VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) = n_new; + cause other variables to be needed. New elements will be + appended, and we remove from the vector those that actually + get emitted. */ + for (i = VEC_length (tree, unemitted_tinfo_decls); + VEC_iterate (tree, unemitted_tinfo_decls, --i, t);) + if (emit_tinfo_decl (t)) + { + reconsider = true; + VEC_unordered_remove (tree, unemitted_tinfo_decls, i); + } /* The list of objects with static storage duration is built up in reverse order. We clear STATIC_AGGREGATES so that any new diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 2dc05ad..b995726 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -73,8 +73,8 @@ Boston, MA 02111-1307, USA. */ /* The IDENTIFIER_NODE naming the real class. */ #define TINFO_REAL_NAME(NODE) TREE_PURPOSE (NODE) -/* A varray of all tinfo decls that haven't yet been emitted. */ -varray_type unemitted_tinfo_decls; +/* A vector of all tinfo decls that haven't yet been emitted. */ +VEC (tree) *unemitted_tinfo_decls; static tree build_headof (tree); static tree ifnonnull (tree, tree); @@ -120,8 +120,8 @@ init_rtti_processing (void) type_info_ptr_type = build_pointer_type (const_type_info_type); type_info_ref_type = build_reference_type (const_type_info_type); - VARRAY_TREE_INIT (unemitted_tinfo_decls, 10, "RTTI decls"); - + unemitted_tinfo_decls = VEC_alloc (tree, 124); + create_tinfo_types (); } @@ -361,8 +361,7 @@ get_tinfo_decl (tree type) pushdecl_top_level_and_finish (d, NULL_TREE); /* Add decl to the global array of tinfo decls. */ - gcc_assert (unemitted_tinfo_decls != 0); - VARRAY_PUSH_TREE (unemitted_tinfo_decls, d); + VEC_safe_push (tree, unemitted_tinfo_decls, d); } return d; |