Commit bcb1079e by Nathan Sidwell Committed by Nathan Sidwell

cp-tree.h (struct lang_type_class): Remove vfields field.

	* cp-tree.h (struct lang_type_class): Remove vfields field.
	(CLASSTYPE_VFIELDS): Remove.
	(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
	* class.c (determine_primary_base): Remove CLASSTYPE_VFIELDS
	handling.
	(dfs_modify_vtables): Use TYPE_CONTAINS_VPTR_P.
	(finish_struct_1): Remove CLASSTYPE_VFIELDS handling.
	* init.c (dfs_initialize_vtbl_ptrs): Use TYPE_CONTAINS_VPTR_P.

From-SVN: r84950
parent fa743e8c
2004-07-20 Nathan Sidwell <nathan@codesourcery.com> 2004-07-20 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (struct lang_type_class): Remove vfields field.
(CLASSTYPE_VFIELDS): Remove.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
* class.c (determine_primary_base): Remove CLASSTYPE_VFIELDS
handling.
(dfs_modify_vtables): Use TYPE_CONTAINS_VPTR_P.
(finish_struct_1): Remove CLASSTYPE_VFIELDS handling.
* init.c (dfs_initialize_vtbl_ptrs): Use TYPE_CONTAINS_VPTR_P.
2004-07-20 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (DEF_VEC_P(tree)): Remove here. * cp-tree.h (DEF_VEC_P(tree)): Remove here.
(BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF):
Moved to common. Moved to common.
......
...@@ -1282,25 +1282,7 @@ determine_primary_base (tree t) ...@@ -1282,25 +1282,7 @@ determine_primary_base (tree t)
continue; continue;
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t)) if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{ set_primary_base (t, base_binfo);
set_primary_base (t, base_binfo);
CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype));
}
else
{
tree vfields;
/* Only add unique vfields, and flatten them out as we go. */
for (vfields = CLASSTYPE_VFIELDS (basetype);
vfields;
vfields = TREE_CHAIN (vfields))
if (VF_BINFO_VALUE (vfields) == NULL_TREE
|| ! BINFO_VIRTUAL_P (VF_BINFO_VALUE (vfields)))
CLASSTYPE_VFIELDS (t)
= tree_cons (base_binfo,
VF_BASETYPE_VALUE (vfields),
CLASSTYPE_VFIELDS (t));
}
} }
} }
...@@ -1382,11 +1364,7 @@ determine_primary_base (tree t) ...@@ -1382,11 +1364,7 @@ determine_primary_base (tree t)
/* If we've got a primary base, use it. */ /* If we've got a primary base, use it. */
if (candidate) if (candidate)
{ set_primary_base (t, candidate);
set_primary_base (t, candidate);
CLASSTYPE_VFIELDS (t)
= copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate)));
}
} }
/* Mark the primary base classes at this point. */ /* Mark the primary base classes at this point. */
...@@ -2193,15 +2171,18 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, ...@@ -2193,15 +2171,18 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
static tree static tree
dfs_modify_vtables (tree binfo, void* data) dfs_modify_vtables (tree binfo, void* data)
{ {
tree t = (tree) data;
if (/* There's no need to modify the vtable for a non-virtual if (/* There's no need to modify the vtable for a non-virtual
primary base; we're not going to use that vtable anyhow. primary base; we're not going to use that vtable anyhow.
We do still need to do this for virtual primary bases, as they We do still need to do this for virtual primary bases, as they
could become non-primary in a construction vtable. */ could become non-primary in a construction vtable. */
(!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo)) (!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo))
/* Similarly, a base without a vtable needs no modification. */ /* Similarly, a base without a vtable needs no modification. */
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo))
/* Don't do the primary vtable, if it's new. */
&& (BINFO_TYPE (binfo) != t || CLASSTYPE_HAS_PRIMARY_BASE_P (t)))
{ {
tree t = (tree) data;
tree virtuals; tree virtuals;
tree old_virtuals; tree old_virtuals;
unsigned ix; unsigned ix;
...@@ -4963,12 +4944,6 @@ finish_struct_1 (tree t) ...@@ -4963,12 +4944,6 @@ finish_struct_1 (tree t)
virtuals = modify_all_vtables (t, nreverse (virtuals)); virtuals = modify_all_vtables (t, nreverse (virtuals));
/* If we created a new vtbl pointer for this class, add it to the
list. */
if (TYPE_VFIELD (t) && !CLASSTYPE_HAS_PRIMARY_BASE_P (t))
CLASSTYPE_VFIELDS (t)
= chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
/* If necessary, create the primary vtable for this class. */ /* If necessary, create the primary vtable for this class. */
if (virtuals || TYPE_CONTAINS_VPTR_P (t)) if (virtuals || TYPE_CONTAINS_VPTR_P (t))
{ {
...@@ -5046,19 +5021,6 @@ finish_struct_1 (tree t) ...@@ -5046,19 +5021,6 @@ finish_struct_1 (tree t)
DECL_SORTED_FIELDS (TYPE_MAIN_DECL (t)) = field_vec; DECL_SORTED_FIELDS (TYPE_MAIN_DECL (t)) = field_vec;
} }
if (TYPE_HAS_CONSTRUCTOR (t))
{
tree vfields = CLASSTYPE_VFIELDS (t);
for (vfields = CLASSTYPE_VFIELDS (t);
vfields; vfields = TREE_CHAIN (vfields))
/* Mark the fact that constructor for T could affect anybody
inheriting from T who wants to initialize vtables for
VFIELDS's type. */
if (VF_BINFO_VALUE (vfields))
TREE_ADDRESSABLE (vfields) = 1;
}
/* Make the rtl for any new vtables we have created, and unmark /* Make the rtl for any new vtables we have created, and unmark
the base types we marked. */ the base types we marked. */
finish_vtbls (t); finish_vtbls (t);
......
...@@ -1003,7 +1003,6 @@ struct lang_type_class GTY(()) ...@@ -1003,7 +1003,6 @@ struct lang_type_class GTY(())
unsigned dummy : 9; unsigned dummy : 9;
tree primary_base; tree primary_base;
tree vfields;
tree vcall_indices; tree vcall_indices;
tree vtables; tree vtables;
tree typeinfo_var; tree typeinfo_var;
...@@ -1386,9 +1385,8 @@ struct lang_type GTY(()) ...@@ -1386,9 +1385,8 @@ struct lang_type GTY(())
#define SET_BINFO_NEW_VTABLE_MARKED(B) \ #define SET_BINFO_NEW_VTABLE_MARKED(B) \
(BINFO_NEW_VTABLE_MARKED (B) = 1, \ (BINFO_NEW_VTABLE_MARKED (B) = 1, \
my_friendly_assert (!BINFO_PRIMARY_P (B) \ my_friendly_assert (!BINFO_PRIMARY_P (B) \
|| BINFO_VIRTUAL_P (B), 20000517), \ || BINFO_VIRTUAL_P (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \ my_friendly_assert (TYPE_VFIELD (BINFO_TYPE (B)), 20000517))
20000517))
/* Nonzero if this BINFO is a primary base class. */ /* Nonzero if this BINFO is a primary base class. */
...@@ -1433,15 +1431,6 @@ struct lang_type GTY(()) ...@@ -1433,15 +1431,6 @@ struct lang_type GTY(())
/* Accessor macros for the vfield slots in structures. */ /* Accessor macros for the vfield slots in structures. */
/* List of virtual table fields that this type contains (both the primary
and secondaries). The TREE_VALUE is the class type where the vtable
field was introduced. For a vtable field inherited from the primary
base, or introduced by this class, the TREE_PURPOSE is NULL. For
other vtable fields (those from non-primary bases), the
TREE_PURPOSE is the BINFO of the base through which the vtable was
inherited. */
#define CLASSTYPE_VFIELDS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vfields)
/* Get the BINFO that introduced this vtable into the hierarchy (will /* Get the BINFO that introduced this vtable into the hierarchy (will
be NULL for those created at this level, or from a primary be NULL for those created at this level, or from a primary
hierarchy). */ hierarchy). */
......
...@@ -102,7 +102,7 @@ static tree ...@@ -102,7 +102,7 @@ static tree
dfs_initialize_vtbl_ptrs (tree binfo, void *data) dfs_initialize_vtbl_ptrs (tree binfo, void *data)
{ {
if ((!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo)) if ((!BINFO_PRIMARY_P (binfo) || BINFO_VIRTUAL_P (binfo))
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo))) && TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
{ {
tree base_ptr = TREE_VALUE ((tree) data); tree base_ptr = TREE_VALUE ((tree) data);
......
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