Commit eaef69ce by Mark Mitchell Committed by Mark Mitchell

cp-treeh (BINFO_NEW_VTABLE_MARKED): Update documentation.

	* cp-treeh (BINFO_NEW_VTABLE_MARKED): Update documentation.
	* init.c (dfs_vtable_path_unmark): Remove.
	* search.c (marked_new_vtable_p): Likewise.
	(unmarked_new_vtable_p): Likewise.
	(dfs_search_slot_nonempty_p): Likewise.
	(dfs_mark): Likewise.
	(dfs_vtable_path_unmark): Likewise.
	(dfs_find_vbases): Don't set BINFO_NEW_VTABLE_MARKED.
	(dfs_int_vbase_pointers): Don't clear BINFO_VTABLE_PATH_MARKED.
	(dfs_init_vbase_pointers): Remove special-case new ABI code.
	(dfs_clear_vbase_slots): Don't clear BINFO_NEW_VTABLE_MARKED.
	(init_vbase_pointers): Simplify.
	(expand_indirect_vtbls_init): Likewise.

From-SVN: r33948
parent 13fa2029
2000-05-16 Mark Mitchell <mark@codesourcery.com> 2000-05-16 Mark Mitchell <mark@codesourcery.com>
* cp-treeh (BINFO_NEW_VTABLE_MARKED): Update documentation.
* init.c (dfs_vtable_path_unmark): Remove.
* search.c (marked_new_vtable_p): Likewise.
(unmarked_new_vtable_p): Likewise.
(dfs_search_slot_nonempty_p): Likewise.
(dfs_mark): Likewise.
(dfs_vtable_path_unmark): Likewise.
(dfs_find_vbases): Don't set BINFO_NEW_VTABLE_MARKED.
(dfs_int_vbase_pointers): Don't clear BINFO_VTABLE_PATH_MARKED.
(dfs_init_vbase_pointers): Remove special-case new ABI code.
(dfs_clear_vbase_slots): Don't clear BINFO_NEW_VTABLE_MARKED.
(init_vbase_pointers): Simplify.
(expand_indirect_vtbls_init): Likewise.
* class.c (copy_virtuals): New function. * class.c (copy_virtuals): New function.
(build_primary_table): Use it. (build_primary_table): Use it.
(build_secondary_vtable): Likewise. (build_secondary_vtable): Likewise.
......
...@@ -1740,8 +1740,11 @@ struct lang_type ...@@ -1740,8 +1740,11 @@ struct lang_type
#define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1)) #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0)) #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
/* Nonzero means B (a BINFO) needs a new vtable. B is part of the /* Nonzero means B (a BINFO) has its own vtable. Under the old ABI,
hierarchy dominated by C. */ secondary vtables are sometimes shared. Any copies will not have
this flag set.
B is part of the hierarchy dominated by C. */
#define BINFO_NEW_VTABLE_MARKED(B, C) \ #define BINFO_NEW_VTABLE_MARKED(B, C) \
(TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C))) (TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
#define SET_BINFO_NEW_VTABLE_MARKED(B, C) \ #define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
...@@ -4351,7 +4354,6 @@ extern tree dfs_walk_real PARAMS ((tree, ...@@ -4351,7 +4354,6 @@ extern tree dfs_walk_real PARAMS ((tree,
tree (*) (tree, void *), tree (*) (tree, void *),
void *)); void *));
extern tree dfs_unmark PARAMS ((tree, void *)); extern tree dfs_unmark PARAMS ((tree, void *));
extern tree dfs_vtable_path_unmark PARAMS ((tree, void *));
extern tree markedp PARAMS ((tree, void *)); extern tree markedp PARAMS ((tree, void *));
extern tree unmarkedp PARAMS ((tree, void *)); extern tree unmarkedp PARAMS ((tree, void *));
extern tree dfs_skip_nonprimary_vbases_unmarkedp PARAMS ((tree, void *)); extern tree dfs_skip_nonprimary_vbases_unmarkedp PARAMS ((tree, void *));
......
...@@ -104,8 +104,6 @@ static void expand_upcast_fixups ...@@ -104,8 +104,6 @@ static void expand_upcast_fixups
static void fixup_virtual_upcast_offsets static void fixup_virtual_upcast_offsets
PARAMS ((tree, tree, int, int, tree, tree, tree, tree, PARAMS ((tree, tree, int, int, tree, tree, tree, tree,
tree *)); tree *));
static tree marked_new_vtablep PARAMS ((tree, void *));
static tree unmarked_new_vtablep PARAMS ((tree, void *));
static tree marked_pushdecls_p PARAMS ((tree, void *)); static tree marked_pushdecls_p PARAMS ((tree, void *));
static tree unmarked_pushdecls_p PARAMS ((tree, void *)); static tree unmarked_pushdecls_p PARAMS ((tree, void *));
static tree dfs_debug_unmarkedp PARAMS ((tree, void *)); static tree dfs_debug_unmarkedp PARAMS ((tree, void *));
...@@ -2442,26 +2440,6 @@ unmarked_vtable_pathp (binfo, data) ...@@ -2442,26 +2440,6 @@ unmarked_vtable_pathp (binfo, data)
return !BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE; return !BINFO_VTABLE_PATH_MARKED (binfo) ? binfo : NULL_TREE;
} }
static tree
marked_new_vtablep (binfo, data)
tree binfo;
void *data;
{
struct vbase_info *vi = (struct vbase_info *) data;
return BINFO_NEW_VTABLE_MARKED (binfo, vi->type) ? binfo : NULL_TREE;
}
static tree
unmarked_new_vtablep (binfo, data)
tree binfo;
void *data;
{
struct vbase_info *vi = (struct vbase_info *) data;
return !BINFO_NEW_VTABLE_MARKED (binfo, vi->type) ? binfo : NULL_TREE;
}
static tree static tree
marked_pushdecls_p (binfo, data) marked_pushdecls_p (binfo, data)
tree binfo; tree binfo;
...@@ -2480,21 +2458,10 @@ unmarked_pushdecls_p (binfo, data) ...@@ -2480,21 +2458,10 @@ unmarked_pushdecls_p (binfo, data)
&& !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE; && !BINFO_PUSHDECLS_MARKED (binfo)) ? binfo : NULL_TREE;
} }
#if 0
static int dfs_search_slot_nonempty_p (binfo) tree binfo;
{ return CLASSTYPE_SEARCH_SLOT (BINFO_TYPE (binfo)) != 0; }
#endif
/* The worker functions for `dfs_walk'. These do not need to /* The worker functions for `dfs_walk'. These do not need to
test anything (vis a vis marking) if they are paired with test anything (vis a vis marking) if they are paired with
a predicate function (above). */ a predicate function (above). */
#if 0
static void
dfs_mark (binfo) tree binfo;
{ SET_BINFO_MARKED (binfo); }
#endif
tree tree
dfs_unmark (binfo, data) dfs_unmark (binfo, data)
tree binfo; tree binfo;
...@@ -2504,17 +2471,6 @@ dfs_unmark (binfo, data) ...@@ -2504,17 +2471,6 @@ dfs_unmark (binfo, data)
return NULL_TREE; return NULL_TREE;
} }
/* Clear BINFO_VTABLE_PATH_MARKED. */
tree
dfs_vtable_path_unmark (binfo, data)
tree binfo;
void *data ATTRIBUTE_UNUSED;
{
CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
return NULL_TREE;
}
/* Attach to the type of the virtual base class, the pointer to the /* Attach to the type of the virtual base class, the pointer to the
virtual base class. */ virtual base class. */
...@@ -2545,7 +2501,6 @@ dfs_find_vbases (binfo, data) ...@@ -2545,7 +2501,6 @@ dfs_find_vbases (binfo, data)
} }
} }
SET_BINFO_VTABLE_PATH_MARKED (binfo); SET_BINFO_VTABLE_PATH_MARKED (binfo);
SET_BINFO_NEW_VTABLE_MARKED (binfo, vi->type);
return NULL_TREE; return NULL_TREE;
} }
...@@ -2560,8 +2515,6 @@ dfs_init_vbase_pointers (binfo, data) ...@@ -2560,8 +2515,6 @@ dfs_init_vbase_pointers (binfo, data)
tree fields; tree fields;
tree this_vbase_ptr; tree this_vbase_ptr;
CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
if (BINFO_INHERITANCE_CHAIN (binfo)) if (BINFO_INHERITANCE_CHAIN (binfo))
{ {
this_vbase_ptr = TREE_CHAIN (BINFO_INHERITANCE_CHAIN (binfo)); this_vbase_ptr = TREE_CHAIN (BINFO_INHERITANCE_CHAIN (binfo));
...@@ -2578,10 +2531,6 @@ dfs_init_vbase_pointers (binfo, data) ...@@ -2578,10 +2531,6 @@ dfs_init_vbase_pointers (binfo, data)
/* We're going to iterate through all the pointers to virtual /* We're going to iterate through all the pointers to virtual
base-classes. They come at the beginning of the class. */ base-classes. They come at the beginning of the class. */
fields = TYPE_FIELDS (type); fields = TYPE_FIELDS (type);
if (fields == TYPE_VFIELD (type))
/* If the first field is the vtbl pointer (as happens in the new
ABI), skip it. */
fields = TREE_CHAIN (fields);
if (fields == NULL_TREE if (fields == NULL_TREE
|| DECL_NAME (fields) == NULL_TREE || DECL_NAME (fields) == NULL_TREE
...@@ -2614,14 +2563,12 @@ dfs_init_vbase_pointers (binfo, data) ...@@ -2614,14 +2563,12 @@ dfs_init_vbase_pointers (binfo, data)
static tree static tree
dfs_clear_vbase_slots (binfo, data) dfs_clear_vbase_slots (binfo, data)
tree binfo; tree binfo;
void *data; void *data ATTRIBUTE_UNUSED;
{ {
tree type = BINFO_TYPE (binfo); tree type = BINFO_TYPE (binfo);
struct vbase_info *vi = (struct vbase_info *) data;
CLASSTYPE_SEARCH_SLOT (type) = 0; CLASSTYPE_SEARCH_SLOT (type) = 0;
CLEAR_BINFO_VTABLE_PATH_MARKED (binfo); CLEAR_BINFO_VTABLE_PATH_MARKED (binfo);
CLEAR_BINFO_NEW_VTABLE_MARKED (binfo, vi->type);
return NULL_TREE; return NULL_TREE;
} }
...@@ -2630,6 +2577,8 @@ init_vbase_pointers (type, decl_ptr) ...@@ -2630,6 +2577,8 @@ init_vbase_pointers (type, decl_ptr)
tree type; tree type;
tree decl_ptr; tree decl_ptr;
{ {
my_friendly_assert (!vbase_offsets_in_vtable_p (), 20000516);
if (TYPE_USES_VIRTUAL_BASECLASSES (type)) if (TYPE_USES_VIRTUAL_BASECLASSES (type))
{ {
struct vbase_info vi; struct vbase_info vi;
...@@ -2653,7 +2602,7 @@ init_vbase_pointers (type, decl_ptr) ...@@ -2653,7 +2602,7 @@ init_vbase_pointers (type, decl_ptr)
marked_vtable_pathp, marked_vtable_pathp,
&vi); &vi);
dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep, &vi); dfs_walk (binfo, dfs_clear_vbase_slots, marked_vtable_pathp, NULL);
flag_this_is_variable = old_flag; flag_this_is_variable = old_flag;
return vi.inits; return vi.inits;
} }
...@@ -2950,7 +2899,9 @@ expand_indirect_vtbls_init (binfo, decl_ptr) ...@@ -2950,7 +2899,9 @@ expand_indirect_vtbls_init (binfo, decl_ptr)
tree binfo; tree binfo;
tree decl_ptr; tree decl_ptr;
{ {
tree type = BINFO_TYPE (binfo); tree type;
type = BINFO_TYPE (binfo);
/* This function executes during the finish_function() segment, /* This function executes during the finish_function() segment,
AFTER the auto variables and temporary stack space has been marked AFTER the auto variables and temporary stack space has been marked
...@@ -2971,9 +2922,9 @@ expand_indirect_vtbls_init (binfo, decl_ptr) ...@@ -2971,9 +2922,9 @@ expand_indirect_vtbls_init (binfo, decl_ptr)
vi.decl_ptr = decl_ptr; vi.decl_ptr = decl_ptr;
vi.vbase_types = vbases; vi.vbase_types = vbases;
dfs_walk (binfo, dfs_find_vbases, unmarked_new_vtablep, &vi); dfs_walk (binfo, dfs_find_vbases, NULL, &vi);
fixup_all_virtual_upcast_offsets (type, vi.decl_ptr); fixup_all_virtual_upcast_offsets (type, vi.decl_ptr);
dfs_walk (binfo, dfs_clear_vbase_slots, marked_new_vtablep, &vi); dfs_walk (binfo, dfs_clear_vbase_slots, marked_vtable_pathp, &vi);
} }
} }
......
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