diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-22 18:12:10 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-22 18:12:10 +0000 |
commit | 2beb8f098a2ea5e7f5d5909378870cf0227c2077 (patch) | |
tree | 3d48eaf3d5b695c2aed8d381f2851caa06e286d3 /gcc | |
parent | e13c1fe6066fcae791d7c2c47168bb529b7a4e7e (diff) | |
download | gcc-2beb8f098a2ea5e7f5d5909378870cf0227c2077.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87872 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-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 f88f663fedf..e91d4251d8d 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 417d179ff0d..c439864c1b1 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 0c05a7ad160..8506ea3b3b8 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 2dc05ad3cab..b995726e09b 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; |