Commit 23656158 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (SET_BINFO_NEW_VTABLE_MARKED): Add sanity checks.

	* cp-tree.h (SET_BINFO_NEW_VTABLE_MARKED): Add sanity checks.
	(VTT_NAME_PREFIX): New macro.
	(CTOR_VTBL_NAME_PREFIX): Likewise.
	(get_ctor_vtbl_name): New function.
	* class.c (get_vtable_name): Simplify.
	(get_vtt_name): New function.
	(get_vtable_decl): Don't set IDENTIFIER_GLOBAL_VALUE.
	(dfs_mark_primary_bases): Update the CLASSTYPE_VBASECLASSES list
	when a virtual base becomes primary.
	(finish_struct_1): Set CLASSTYPE_VFIELDS a little earlier.  Build
	VTTs.
	(finish_vtbls): Adjust calls to accumulate_vtbl_inits to pass in
	additional parameters.
	(dfs_finish_vtbls): Don't clear BINFO_NEW_VTABLE_MARKED.
	(initialize_array): New function.
	(build_vtt): Likewise.
	(build_vtt_inits): Likewise.
	(dfs_build_vtt_inits): Likewise.
	(dfs_fixup_binfo_vtbls): Likewise.
	(build_ctor_vtbl_group): Likewise.
	(initialize_vtable): Use initialize_array.
	(accumulate_vtbl_inits): Reimplement to handle construction
	vtables.
	(dfs_accumulate_vtbl_inits): Likewise.
	(bulid_vtbl_initializer): Adjust parameter name.
	* method.c (build_typename_overload): Remove #if 0'd code.
	(get_ctor_vtbl_name): New function.
	* search.c (dfs_walk_real): Use BINFO_N_BASETYPES.
	(init_vbase_pointers): Don't mess with the TREE_CHAIN of a binfo.

From-SVN: r34069
parent f85cf636
2000-05-21 Mark Mitchell <mark@codesourcery.com> 2000-05-21 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (SET_BINFO_NEW_VTABLE_MARKED): Add sanity checks.
(VTT_NAME_PREFIX): New macro.
(CTOR_VTBL_NAME_PREFIX): Likewise.
(get_ctor_vtbl_name): New function.
* class.c (get_vtable_name): Simplify.
(get_vtt_name): New function.
(get_vtable_decl): Don't set IDENTIFIER_GLOBAL_VALUE.
(dfs_mark_primary_bases): Update the CLASSTYPE_VBASECLASSES list
when a virtual base becomes primary.
(finish_struct_1): Set CLASSTYPE_VFIELDS a little earlier. Build
VTTs.
(finish_vtbls): Adjust calls to accumulate_vtbl_inits to pass in
additional parameters.
(dfs_finish_vtbls): Don't clear BINFO_NEW_VTABLE_MARKED.
(initialize_array): New function.
(build_vtt): Likewise.
(build_vtt_inits): Likewise.
(dfs_build_vtt_inits): Likewise.
(dfs_fixup_binfo_vtbls): Likewise.
(build_ctor_vtbl_group): Likewise.
(initialize_vtable): Use initialize_array.
(accumulate_vtbl_inits): Reimplement to handle construction
vtables.
(dfs_accumulate_vtbl_inits): Likewise.
(bulid_vtbl_initializer): Adjust parameter name.
* method.c (build_typename_overload): Remove #if 0'd code.
(get_ctor_vtbl_name): New function.
* search.c (dfs_walk_real): Use BINFO_N_BASETYPES.
(init_vbase_pointers): Don't mess with the TREE_CHAIN of a binfo.
* cp-tree.h (struct lang_type): Remove search_slot. * cp-tree.h (struct lang_type): Remove search_slot.
(CLASSTYPE_SEARCH_SLOT): Remove. (CLASSTYPE_SEARCH_SLOT): Remove.
(emit_base_init): Change prototype. (emit_base_init): Change prototype.
......
...@@ -1597,7 +1597,11 @@ struct lang_type ...@@ -1597,7 +1597,11 @@ struct lang_type
/* A chain of BINFOs for the direct and indirect virtual base classes /* A chain of BINFOs for the direct and indirect virtual base classes
that this type uses in a post-order depth-first left-to-right that this type uses in a post-order depth-first left-to-right
order. (In other words, these bases appear in the order that they order. (In other words, these bases appear in the order that they
should be initialized.) */ should be initialized.) If a virtual base is primary, then the
primary copy will appear on this list. Thus, the BINFOs on this
list are all "real"; they are the same BINFOs that will be
encountered when using dfs_unmarked_real_bases_queue_p and related
functions. */
#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases) #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
/* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the /* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
...@@ -1721,8 +1725,15 @@ struct lang_type ...@@ -1721,8 +1725,15 @@ struct lang_type
B is part of the hierarchy dominated by C. */ 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) \
(BINFO_NEW_VTABLE_MARKED (B, C) = 1) /* Any subobject that needs a new vtable must have a vptr and must not
be a primary base (since it would then use the vtable from a
derived class.) */
#define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
(BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
my_friendly_assert (!BINFO_PRIMARY_MARKED_P (B), 20000517), \
my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
20000517))
#define CLEAR_BINFO_NEW_VTABLE_MARKED(B, C) \ #define CLEAR_BINFO_NEW_VTABLE_MARKED(B, C) \
(BINFO_NEW_VTABLE_MARKED (B, C) = 0) (BINFO_NEW_VTABLE_MARKED (B, C) = 0)
...@@ -3438,6 +3449,15 @@ extern tree original_function_name; ...@@ -3438,6 +3449,15 @@ extern tree original_function_name;
#define EXCEPTION_CLEANUP_NAME "exception cleanup" #define EXCEPTION_CLEANUP_NAME "exception cleanup"
/* The name used as a prefix for VTTs. When the new ABI mangling
scheme is implemented, this should be removed. */
#define VTT_NAME_PREFIX "__vtt_"
/* The name used as a prefix for construction vtables. */
#define CTOR_VTBL_NAME_PREFIX "__ctorvt_"
#define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0) #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
...@@ -4187,6 +4207,7 @@ extern void emit_thunk PARAMS ((tree)); ...@@ -4187,6 +4207,7 @@ extern void emit_thunk PARAMS ((tree));
extern void synthesize_method PARAMS ((tree)); extern void synthesize_method PARAMS ((tree));
extern tree get_id_2 PARAMS ((const char *, tree)); extern tree get_id_2 PARAMS ((const char *, tree));
extern tree implicitly_declare_fn PARAMS ((special_function_kind, tree, int)); extern tree implicitly_declare_fn PARAMS ((special_function_kind, tree, int));
extern tree get_ctor_vtbl_name PARAMS ((tree, tree));
/* In optimize.c */ /* In optimize.c */
extern void optimize_function PARAMS ((tree)); extern void optimize_function PARAMS ((tree));
......
...@@ -1766,9 +1766,6 @@ build_typename_overload (type) ...@@ -1766,9 +1766,6 @@ build_typename_overload (type)
build_mangled_name (type, 0, 1); build_mangled_name (type, 0, 1);
id = get_identifier (obstack_base (&scratch_obstack)); id = get_identifier (obstack_base (&scratch_obstack));
IDENTIFIER_OPNAME_P (id) = 1; IDENTIFIER_OPNAME_P (id) = 1;
#if 0
IDENTIFIER_GLOBAL_VALUE (id) = TYPE_MAIN_DECL (type);
#endif
TREE_TYPE (id) = type; TREE_TYPE (id) = type;
end_squangling (); end_squangling ();
return id; return id;
...@@ -1800,6 +1797,28 @@ get_id_2 (name, name2) ...@@ -1800,6 +1797,28 @@ get_id_2 (name, name2)
return get_identifier (obstack_base (&scratch_obstack)); return get_identifier (obstack_base (&scratch_obstack));
} }
/* Returns the name of a construction vtable group. TYPE is the most
derived class in the hierarhcy. BINFO is the most derived class in
the construction vtable group. */
tree
get_ctor_vtbl_name (type, binfo)
tree type;
tree binfo;
{
start_squangling ();
OB_INIT ();
OB_PUTCP (CTOR_VTBL_NAME_PREFIX);
build_mangled_name (type, 0, 0);
OB_PUTC ('_');
build_mangled_name (BINFO_TYPE (binfo), 0, 0);
OB_PUTC ('_');
build_overload_int (BINFO_OFFSET (binfo), mf_none);
OB_FINISH ();
end_squangling ();
return get_identifier (obstack_base (&scratch_obstack));
}
/* Returns a DECL_ASSEMBLER_NAME for the destructor of type TYPE. */ /* Returns a DECL_ASSEMBLER_NAME for the destructor of type TYPE. */
tree tree
......
...@@ -1859,7 +1859,7 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data) ...@@ -1859,7 +1859,7 @@ dfs_walk_real (binfo, prefn, postfn, qfn, data)
/* Process the basetypes. */ /* Process the basetypes. */
binfos = BINFO_BASETYPES (binfo); binfos = BINFO_BASETYPES (binfo);
n_baselinks = binfos ? TREE_VEC_LENGTH (binfos): 0; n_baselinks = BINFO_N_BASETYPES (binfo);
for (i = 0; i < n_baselinks; i++) for (i = 0; i < n_baselinks; i++)
{ {
tree base_binfo = TREE_VEC_ELT (binfos, i); tree base_binfo = TREE_VEC_ELT (binfos, i);
...@@ -2521,7 +2521,6 @@ init_vbase_pointers (type, decl_ptr) ...@@ -2521,7 +2521,6 @@ init_vbase_pointers (type, decl_ptr)
vi.inits = NULL_TREE; vi.inits = NULL_TREE;
/* Build up a list of the initializers. */ /* Build up a list of the initializers. */
TREE_CHAIN (binfo) = decl_ptr;
dfs_walk_real (binfo, dfs_walk_real (binfo,
dfs_init_vbase_pointers, 0, dfs_init_vbase_pointers, 0,
unmarked_vtable_pathp, unmarked_vtable_pathp,
......
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