Commit 94214953 by Nathan Sidwell Committed by Nathan Sidwell

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
parent 8739ed59
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.
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment