static tree get_basefndecls PARAMS ((tree, tree));
static int build_primary_vtable PARAMS ((tree, tree));
static int build_secondary_vtable PARAMS ((tree, tree));
-static tree dfs_finish_vtbls PARAMS ((tree, void *));
static void finish_vtbls PARAMS ((tree));
static void modify_vtable_entry PARAMS ((tree, tree, tree, tree, tree *));
static void add_virtual_function PARAMS ((tree *, tree *, int *, tree, tree));
splay_tree, tree));
static bool build_base_fields PARAMS ((record_layout_info, int *,
splay_tree, tree));
-static tree build_vbase_pointer_fields PARAMS ((record_layout_info, int *));
static tree build_vtbl_or_vbase_field PARAMS ((tree, tree, tree, tree, tree,
int *));
static void check_methods PARAMS ((tree));
/* Virtual base class layout. */
-/* Returns a list of virtual base class pointers as a chain of
- FIELD_DECLS. */
-
-static tree
-build_vbase_pointer_fields (rli, empty_p)
- record_layout_info rli;
- int *empty_p;
-{
- /* Chain to hold all the new FIELD_DECLs which point at virtual
- base classes. */
- tree rec = rli->t;
- tree vbase_decls = NULL_TREE;
- tree binfos = TYPE_BINFO_BASETYPES (rec);
- int n_baseclasses = CLASSTYPE_N_BASECLASSES (rec);
- tree decl;
- int i;
-
- /* Under the new ABI, there are no vbase pointers in the object.
- Instead, the offsets are stored in the vtable. */
- if (vbase_offsets_in_vtable_p ())
- return NULL_TREE;
-
- /* Loop over the baseclasses, adding vbase pointers as needed. */
- for (i = 0; i < n_baseclasses; i++)
- {
- register tree base_binfo = TREE_VEC_ELT (binfos, i);
- register tree basetype = BINFO_TYPE (base_binfo);
-
- if (!COMPLETE_TYPE_P (basetype))
- /* This error is now reported in xref_tag, thus giving better
- location information. */
- continue;
-
- /* All basetypes are recorded in the association list of the
- derived type. */
-
- if (TREE_VIA_VIRTUAL (base_binfo))
- {
- int j;
- const char *name;
-
- /* The offset for a virtual base class is only used in computing
- virtual function tables and for initializing virtual base
- pointers. It is built once `get_vbase_types' is called. */
-
- /* If this basetype can come from another vbase pointer
- without an additional indirection, we will share
- that pointer. If an indirection is involved, we
- make our own pointer. */
- for (j = 0; j < n_baseclasses; j++)
- {
- tree other_base_binfo = TREE_VEC_ELT (binfos, j);
- if (! TREE_VIA_VIRTUAL (other_base_binfo)
- && binfo_for_vbase (basetype, BINFO_TYPE (other_base_binfo)))
- goto got_it;
- }
- FORMAT_VBASE_NAME (name, basetype);
- decl = build_vtbl_or_vbase_field (get_identifier (name),
- get_identifier (VTABLE_BASE),
- build_pointer_type (basetype),
- rec,
- basetype,
- empty_p);
- BINFO_VPTR_FIELD (base_binfo) = decl;
- TREE_CHAIN (decl) = vbase_decls;
- place_field (rli, decl);
- vbase_decls = decl;
- *empty_p = 0;
-
- got_it:
- /* The space this decl occupies has already been accounted for. */
- ;
- }
- }
-
- return vbase_decls;
-}
-
/* Returns a pointer to the virtual base class of EXP that has the
indicated TYPE. EXP is of class type, not a pointer type. */
build_vbase_pointer (exp, type)
tree exp, type;
{
- if (vbase_offsets_in_vtable_p ())
- {
- tree vbase;
- tree vbase_ptr;
-
- /* Find the shared copy of TYPE; that's where the vtable offset
- is recorded. */
- vbase = binfo_for_vbase (type, TREE_TYPE (exp));
- /* Find the virtual function table pointer. */
- vbase_ptr = build_vfield_ref (exp, TREE_TYPE (exp));
- /* Compute the location where the offset will lie. */
- vbase_ptr = build (PLUS_EXPR,
- TREE_TYPE (vbase_ptr),
- vbase_ptr,
- BINFO_VPTR_FIELD (vbase));
- vbase_ptr = build1 (NOP_EXPR,
- build_pointer_type (ptrdiff_type_node),
- vbase_ptr);
- /* Add the contents of this location to EXP. */
- return build (PLUS_EXPR,
- build_pointer_type (type),
- build_unary_op (ADDR_EXPR, exp, /*noconvert=*/0),
- build1 (INDIRECT_REF, ptrdiff_type_node, vbase_ptr));
- }
- else
- {
- char *name;
- FORMAT_VBASE_NAME (name, type);
- return build_component_ref (exp, get_identifier (name), NULL_TREE, 0);
- }
+ tree vbase;
+ tree vbase_ptr;
+
+ /* Find the shared copy of TYPE; that's where the vtable offset is
+ recorded. */
+ vbase = binfo_for_vbase (type, TREE_TYPE (exp));
+ /* Find the virtual function table pointer. */
+ vbase_ptr = build_vfield_ref (exp, TREE_TYPE (exp));
+ /* Compute the location where the offset will lie. */
+ vbase_ptr = build (PLUS_EXPR,
+ TREE_TYPE (vbase_ptr),
+ vbase_ptr,
+ BINFO_VPTR_FIELD (vbase));
+ vbase_ptr = build1 (NOP_EXPR,
+ build_pointer_type (ptrdiff_type_node),
+ vbase_ptr);
+ /* Add the contents of this location to EXP. */
+ return build (PLUS_EXPR,
+ build_pointer_type (type),
+ build_unary_op (ADDR_EXPR, exp, /*noconvert=*/0),
+ build1 (INDIRECT_REF, ptrdiff_type_node, vbase_ptr));
}
/* Build multi-level access to EXPR using hierarchy path PATH.
{
vtbl = TYPE_BINFO_VTABLE (basetype);
/* Knowing the dynamic type of INSTANCE we can easily obtain
- the correct vtable entry. In the new ABI, we resolve
- this back to be in terms of the primary vtable. */
+ the correct vtable entry. We resolve this back to be in
+ terms of the primary vtable. */
if (TREE_CODE (vtbl) == PLUS_EXPR)
{
idx = fold (build (PLUS_EXPR,
return 1;
}
-/* Give TYPE a new virtual function table which is initialized
+/* Give BINFO a new virtual function table which is initialized
with a skeleton-copy of its original initialization. The only
entry that changes is the `delta' entry, so we can really
share a lot of structure.
- FOR_TYPE is the derived type which caused this table to
+ FOR_TYPE is the most derived type which caused this table to
be needed.
- BINFO is the type association which provided TYPE for FOR_TYPE.
+ Returns non-zero if we haven't met BINFO before.
The order in which vtables are built (by calling this function) for
an object must remain the same, otherwise a binary incompatibility
build_secondary_vtable (binfo, for_type)
tree binfo, for_type;
{
- tree basetype;
- tree orig_decl = BINFO_VTABLE (binfo);
- tree name;
- tree new_decl;
- tree offset;
- tree path = binfo;
- char *buf;
- const char *buf2;
- char joiner = '_';
- int i;
-
-#ifdef JOINER
- joiner = JOINER;
-#endif
-
- if (TREE_VIA_VIRTUAL (binfo))
- my_friendly_assert (binfo == binfo_for_vbase (BINFO_TYPE (binfo),
- current_class_type),
- 170);
+ my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
- if (BINFO_NEW_VTABLE_MARKED (binfo, current_class_type))
+ if (BINFO_NEW_VTABLE_MARKED (binfo, for_type))
/* We already created a vtable for this base. There's no need to
do it again. */
return 0;
/* Remember that we've created a vtable for this BINFO, so that we
don't try to do so again. */
- SET_BINFO_NEW_VTABLE_MARKED (binfo, current_class_type);
+ SET_BINFO_NEW_VTABLE_MARKED (binfo, for_type);
/* Make fresh virtual list, so we can smash it later. */
BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
- my_friendly_assert (binfo == CANONICAL_BINFO (binfo, for_type), 20010605);
- offset = BINFO_OFFSET (binfo);
-
- /* In the new ABI, secondary vtables are laid out as part of the
- same structure as the primary vtable. */
- if (merge_primary_and_secondary_vtables_p ())
- {
- BINFO_VTABLE (binfo) = NULL_TREE;
- return 1;
- }
-
- /* Create the declaration for the secondary vtable. */
- basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (binfo));
- buf2 = TYPE_ASSEMBLER_NAME_STRING (basetype);
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1;
-
- /* We know that the vtable that we are going to create doesn't exist
- yet in the global namespace, and when we finish, it will be
- pushed into the global namespace. In complex MI hierarchies, we
- have to loop while the name we are thinking of adding is globally
- defined, adding more name components to the vtable name as we
- loop, until the name is unique. This is because in complex MI
- cases, we might have the same base more than once. This means
- that the order in which this function is called for vtables must
- remain the same, otherwise binary compatibility can be
- compromised. */
-
- while (1)
- {
- char *buf1 = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (for_type)
- + 1 + i);
- char *new_buf2;
-
- sprintf (buf1, "%s%c%s", TYPE_ASSEMBLER_NAME_STRING (for_type), joiner,
- buf2);
- buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX) + strlen (buf1) + 1);
- sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
- name = get_identifier (buf);
-
- /* If this name doesn't clash, then we can use it, otherwise
- we add more to the name until it is unique. */
-
- if (! IDENTIFIER_GLOBAL_VALUE (name))
- break;
-
- /* Set values for next loop through, if the name isn't unique. */
-
- path = BINFO_INHERITANCE_CHAIN (path);
-
- /* We better not run out of stuff to make it unique. */
- my_friendly_assert (path != NULL_TREE, 368);
-
- basetype = TYPE_MAIN_VARIANT (BINFO_TYPE (path));
-
- if (for_type == basetype)
- {
- /* If we run out of basetypes in the path, we have already
- found created a vtable with that name before, we now
- resort to tacking on _%d to distinguish them. */
- int j = 2;
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i + 1 + 3;
- buf1 = (char *) alloca (i);
- do {
- sprintf (buf1, "%s%c%s%c%d",
- TYPE_ASSEMBLER_NAME_STRING (basetype), joiner,
- buf2, joiner, j);
- buf = (char *) alloca (strlen (VTABLE_NAME_PREFIX)
- + strlen (buf1) + 1);
- sprintf (buf, "%s%s", VTABLE_NAME_PREFIX, buf1);
- name = get_identifier (buf);
-
- /* If this name doesn't clash, then we can use it,
- otherwise we add something different to the name until
- it is unique. */
- } while (++j <= 999 && IDENTIFIER_GLOBAL_VALUE (name));
-
- /* Hey, they really like MI don't they? Increase the 3
- above to 6, and the 999 to 999999. :-) */
- my_friendly_assert (j <= 999, 369);
-
- break;
- }
-
- i = TYPE_ASSEMBLER_NAME_LENGTH (basetype) + 1 + i;
- new_buf2 = (char *) alloca (i);
- sprintf (new_buf2, "%s%c%s",
- TYPE_ASSEMBLER_NAME_STRING (basetype), joiner, buf2);
- buf2 = new_buf2;
- }
-
- new_decl = build_vtable (for_type, name, TREE_TYPE (orig_decl));
- DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl);
- DECL_USER_ALIGN (new_decl) = DECL_USER_ALIGN (orig_decl);
- BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl);
-
-#ifdef GATHER_STATISTICS
- n_vtables += 1;
- n_vtable_elems += list_length (BINFO_VIRTUALS (binfo));
-#endif
-
+ /* Secondary vtables are laid out as part of the same structure as
+ the primary vtable. */
+ BINFO_VTABLE (binfo) = NULL_TREE;
return 1;
}
/* Create a new vtable for BINFO which is the hierarchy dominated by
- T. */
+ T. Return non-zero if we actually created a new vtable. */
static int
make_new_vtable (t, binfo)
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
CLASSTYPE_RTTI (t) = CLASSTYPE_RTTI (basetype);
- /* A virtual baseclass can't be the primary base under the
- old ABI. And under the new ABI we still prefer a
- non-virtual base. */
+ /* We prefer a non-virtual base, although a virtual one will
+ do. */
if (TREE_VIA_VIRTUAL (base_binfo))
continue;
}
}
- /* The new ABI allows for the use of a "nearly-empty" virtual base
- class as the primary base class if no non-virtual polymorphic
- base can be found. */
+ /* A "nearly-empty" virtual base class can be the primary base
+ class, if no non-virtual polymorphic base can be found. */
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
{
/* If not NULL, this is the best primary base candidate we have
the final overrider, and not to an intermediate virtual base. */
virtual_base = NULL_TREE;
- /* Under the new ABI, we will convert to an intermediate virtual
- base first, and then use the vcall offset located there to finish
- the conversion. */
+ /* We will convert to an intermediate virtual base first, and then
+ use the vcall offset located there to finish the conversion. */
while (b)
{
/* If we find the final overrider, then we can stop
t = (tree) data;
- /* If we're supporting RTTI then we always need a new vtable to
- point to the RTTI information. Under the new ABI we may need
- a new vtable to contain vcall and vbase offsets. */
make_new_vtable (t, binfo);
/* Now, go through each of the virtual functions in the virtual
int *vfuns_p;
tree overridden_virtuals;
{
- tree binfo;
-
- binfo = TYPE_BINFO (t);
+ tree binfo = TYPE_BINFO (t);
+ tree *fnsp;
/* Update all of the vtables. */
dfs_walk (binfo,
t);
dfs_walk (binfo, dfs_unmark, dfs_marked_real_bases_queue_p, t);
- /* If we should include overriding functions for secondary vtables
- in our primary vtable, add them now. */
- if (all_overridden_vfuns_in_vtables_p ())
+ /* Include overriding functions for secondary vtables in our primary
+ vtable. */
+ for (fnsp = &overridden_virtuals; *fnsp; )
{
- tree *fnsp = &overridden_virtuals;
+ tree fn = TREE_VALUE (*fnsp);
- while (*fnsp)
+ if (!BINFO_VIRTUALS (binfo)
+ || !value_member (fn, BINFO_VIRTUALS (binfo)))
{
- tree fn = TREE_VALUE (*fnsp);
-
- if (!BINFO_VIRTUALS (binfo)
- || !value_member (fn, BINFO_VIRTUALS (binfo)))
- {
- /* Set the vtable index. */
- set_vindex (fn, vfuns_p);
- /* We don't need to convert to a base class when calling
- this function. */
- DECL_VIRTUAL_CONTEXT (fn) = t;
-
- /* We don't need to adjust the `this' pointer when
- calling this function. */
- BV_DELTA (*fnsp) = integer_zero_node;
- BV_VCALL_INDEX (*fnsp) = NULL_TREE;
-
- /* This is an overridden function not already in our
- vtable. Keep it. */
- fnsp = &TREE_CHAIN (*fnsp);
- }
- else
- /* We've already got an entry for this function. Skip
- it. */
- *fnsp = TREE_CHAIN (*fnsp);
+ /* Set the vtable index. */
+ set_vindex (fn, vfuns_p);
+ /* We don't need to convert to a base class when calling
+ this function. */
+ DECL_VIRTUAL_CONTEXT (fn) = t;
+
+ /* We don't need to adjust the `this' pointer when
+ calling this function. */
+ BV_DELTA (*fnsp) = integer_zero_node;
+ BV_VCALL_INDEX (*fnsp) = NULL_TREE;
+
+ /* This is an overridden function not already in our
+ vtable. Keep it. */
+ fnsp = &TREE_CHAIN (*fnsp);
}
+ else
+ /* We've already got an entry for this function. Skip it. */
+ *fnsp = TREE_CHAIN (*fnsp);
}
- else
- overridden_virtuals = NULL_TREE;
-
+
return overridden_virtuals;
}
int i;
bool atend = 0;
- /* Under the new ABI, the primary base class is always allocated
- first. */
+ /* The primary base class is always allocated first. */
if (CLASSTYPE_HAS_PRIMARY_BASE_P (rec))
build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (rec),
empty_p, offsets, t);
base_binfo = BINFO_BASETYPE (TYPE_BINFO (rec), i);
- /* Under the new ABI, the primary base was already allocated
- above, so we don't need to allocate it again here. */
+ /* The primary base was already allocated above, so we don't
+ need to allocate it again here. */
if (base_binfo == CLASSTYPE_PRIMARY_BINFO (rec))
continue;
here. Even if there weren't any new virtual functions, we might need a
new virtual function table if we're supposed to include vptrs in
all classes that need them. */
- if (!TYPE_VFIELD (t)
- && (*vfuns_p
- || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ())))
+ if (!TYPE_VFIELD (t) && (*vfuns_p || TYPE_CONTAINS_VPTR_P (t)))
{
/* We build this decl with vtbl_ptr_type_node, which is a
`vtable_entry_type*'. It might seem more precise to use
TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), BITS_PER_UNIT);
/* Go through the virtual bases, allocating space for each virtual
- base that is not already a primary base class. Under the old
- ABI, these are allocated according to a depth-first left-to-right
- postorder traversal; in the new ABI, inheritance graph order is
- used instead. */
+ base that is not already a primary base class. These are
+ allocated in inheritance graph order. */
for (vbases = TYPE_BINFO (t);
vbases;
vbases = TREE_CHAIN (vbases))
appropriately aligned offset. */
dsize = CEIL (dsize, desired_align) * desired_align;
- /* Under the new ABI, we try to squish empty virtual bases in
- just like ordinary empty bases. */
+ /* We try to squish empty virtual bases in just like
+ ordinary empty bases. */
if (is_empty_class (basetype))
layout_empty_base (vbase,
size_int (CEIL (dsize, BITS_PER_UNIT)),
vptr = create_vtable_ptr (t, empty_p, vfuns_p,
new_virtuals_p, overridden_virtuals_p);
- /* Under the new ABI, the vptr is always the first thing in the
- class. */
+ /* The vptr is always the first thing in the class. */
if (vptr)
{
TYPE_FIELDS (t) = chainon (vptr, TYPE_FIELDS (t));
if (build_base_fields (rli, empty_p, empty_base_offsets, t))
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
- /* Add pointers to all of our virtual base-classes. */
- TYPE_FIELDS (t) = chainon (build_vbase_pointer_fields (rli, empty_p),
- TYPE_FIELDS (t));
-
/* CLASSTYPE_INLINE_FRIENDS is really TYPE_NONCOPIED_PARTS. Thus,
we have to save this before we start modifying
TYPE_NONCOPIED_PARTS. */
type = TREE_TYPE (field);
/* If this field is a bit-field whose width is greater than its
- type, then there are some special rules for allocating it
- under the new ABI. Under the old ABI, there were no special
- rules, but the back-end can't handle bitfields longer than a
- `long long', so we use the same mechanism. */
+ type, then there are some special rules for allocating
+ it. */
if (DECL_C_BIT_FIELD (field)
&& INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
{
}
/* We make all structures have at least one element, so that they
- have non-zero size. In the new ABI, the class may be empty even
- if it has basetypes. Therefore, we add the fake field after all
- the other fields; if there are already FIELD_DECLs on the list,
- their offsets will not be disturbed. */
+ have non-zero size. The class may be empty even if it has
+ basetypes. Therefore, we add the fake field after all the other
+ fields; if there are already FIELD_DECLs on the list, their
+ offsets will not be disturbed. */
if (!eoc && *empty_p)
{
tree padding;
= chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
/* If necessary, create the primary vtable for this class. */
- if (new_virtuals
- || overridden_virtuals
- || (TYPE_CONTAINS_VPTR_P (t) && vptrs_present_everywhere_p ()))
+ if (new_virtuals || overridden_virtuals || TYPE_CONTAINS_VPTR_P (t))
{
new_virtuals = nreverse (new_virtuals);
/* We must enter these virtuals into the table. */
}
}
-/* Returns the VAR_DECL for the complete vtable associated with
- BINFO. (Under the new ABI, secondary vtables are merged with
- primary vtables; this function will return the VAR_DECL for the
- primary vtable.) */
+/* Returns the VAR_DECL for the complete vtable associated with BINFO.
+ Secondary vtables are merged with primary vtables; this function
+ will return the VAR_DECL for the primary vtable. */
tree
get_vtbl_decl_for_binfo (binfo)
finish_vtbls (t)
tree t;
{
- if (merge_primary_and_secondary_vtables_p ())
- {
- tree list;
- tree vbase;
+ tree list;
+ tree vbase;
- /* Under the new ABI, we lay out the primary and secondary
- vtables in one contiguous vtable. The primary vtable is
- first, followed by the non-virtual secondary vtables in
- inheritance graph order. */
- list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE);
- accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
- TYPE_BINFO (t), t, list);
- /* Then come the virtual bases, also in inheritance graph
- order. */
- for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
- {
- tree real_base;
+ /* We lay out the primary and secondary vtables in one contiguous
+ vtable. The primary vtable is first, followed by the non-virtual
+ secondary vtables in inheritance graph order. */
+ list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE);
+ accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
+ TYPE_BINFO (t), t, list);
+
+ /* Then come the virtual bases, also in inheritance graph order. */
+ for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
+ {
+ tree real_base;
- if (!TREE_VIA_VIRTUAL (vbase))
- continue;
+ if (!TREE_VIA_VIRTUAL (vbase))
+ continue;
- /* Although we walk in inheritance order, that might not get the
- canonical base. */
- real_base = binfo_for_vbase (BINFO_TYPE (vbase), t);
+ /* Although we walk in inheritance order, that might not get the
+ canonical base. */
+ real_base = binfo_for_vbase (BINFO_TYPE (vbase), t);
- accumulate_vtbl_inits (real_base, real_base,
- TYPE_BINFO (t), t, list);
- }
-
- if (TYPE_BINFO_VTABLE (t))
- initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
- }
- else
- {
- dfs_walk (TYPE_BINFO (t), dfs_finish_vtbls,
- dfs_unmarked_real_bases_queue_p, t);
- dfs_walk (TYPE_BINFO (t), dfs_unmark,
- dfs_marked_real_bases_queue_p, t);
+ accumulate_vtbl_inits (real_base, real_base,
+ TYPE_BINFO (t), t, list);
}
-}
-/* Called from finish_vtbls via dfs_walk. */
-
-static tree
-dfs_finish_vtbls (binfo, data)
- tree binfo;
- void *data;
-{
- tree t = (tree) data;
-
- if (BINFO_NEW_VTABLE_MARKED (binfo, t))
- initialize_vtable (binfo,
- build_vtbl_initializer (binfo, binfo, t,
- TYPE_BINFO (t), NULL));
-
- SET_BINFO_MARKED (binfo);
-
- return NULL_TREE;
+ if (TYPE_BINFO_VTABLE (t))
+ initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
}
/* Initialize the vtable for BINFO with the INITS. */
}
}
-/* Called from accumulate_vtbl_inits when using the new ABI.
- Accumulates the vtable initializers for all of the vtables into
- TREE_VALUE (DATA). Returns the initializers for the BINFO vtable. */
+/* Called from accumulate_vtbl_inits. Returns the initializers for
+ the BINFO vtable. */
static tree
dfs_accumulate_vtbl_inits (binfo, orig_binfo, rtti_binfo, t, l)
tree vbase;
tree t;
- /* Under the old ABI, pointers to virtual bases are stored in each
- object. */
- if (!vbase_offsets_in_vtable_p ())
- return;
-
/* If there are no virtual baseclasses, then there is nothing to
do. */
if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
tree binfo;
vtbl_init_data *vid;
{
- /* Under the old ABI, the adjustments to the `this' pointer were made
- elsewhere. */
- if (!vcall_offsets_in_vtable_p ())
- return;
-
/* We only need these entries if this base is a virtual base. */
if (!TREE_VIA_VIRTUAL (binfo))
return;
The BV_FN is the declaration for the virtual function itself.
BINFO_VTABLE
- Sometimes this is a VAR_DECL. Under the new ABI, it is instead
- an expression with POINTER_TYPE pointing that gives the value
+ This is an expression with POINTER_TYPE that gives the value
to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
- to extract the VAR_DECL for the complete vtable; that macro works
- in both ABIs.
+ to extract the VAR_DECL for the complete vtable.
DECL_ARGUMENTS
For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
extern int flag_huge_objects;
-/* Nonzero if virtual base class offsets are stored in the virtual
- function table. Zero if, instead, a pointer to the virtual base is
- stored in the object itself. */
-#define vbase_offsets_in_vtable_p() (1)
-
-/* Nonzero if displacements to the `this' pointer to use when calling
- virtual functions in a virtual base class are present in the
- vtable. */
-#define vcall_offsets_in_vtable_p() (1)
-
-/* Nonzero if a derived class that needs a vptr should always get one,
- even if a non-primary base class already has one. For example,
- given:
-
- struct S { int i; virtual void f(); };
- struct T : virtual public S {};
-
- one could either reuse the vptr in `S' for `T', or create a new
- vptr for `T'. If this flag is nonzero we choose the latter
- alternative; otherwise, we choose the former. */
-#define vptrs_present_everywhere_p() (1)
-
-/* Nonzero if the vtable for a derived class should contain the
- virtual functions from the primary base and all virtual functions
- present in the class itself. Zero if, instead, it should contain
- only those virtual functions from the primary base together with
- the functions declared in the derived class (but not in any base
- class). */
-#define all_overridden_vfuns_in_vtables_p() (1)
-
-/* Nonzero if primary and secondary vtables are combined into a single
- vtable. */
-#define merge_primary_and_secondary_vtables_p() (1)
-
\f
/* Language-dependent contents of an identifier. */
/* Nonzero if this class has a virtual function table pointer. */
#define TYPE_CONTAINS_VPTR_P(NODE) \
(TYPE_POLYMORPHIC_P (NODE) \
- || (vbase_offsets_in_vtable_p () \
- && TYPE_USES_VIRTUAL_BASECLASSES (NODE)))
+ || TYPE_USES_VIRTUAL_BASECLASSES (NODE))
extern int flag_new_for_scope;
/* A pointer-to-function member type looks like:
- struct {
- short __delta;
- short __index;
- union {
- P __pfn;
- short __delta2;
- } __pfn_or_delta2;
- };
-
- where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
- pointer to member. The fields are used as follows:
-
- If __INDEX is -1, then the function to call is non-virtual, and
- is located at the address given by __PFN.
-
- If __INDEX is zero, then this a NULL pointer-to-member.
-
- Otherwise, the function to call is virtual. Then, __DELTA2 gives
- the offset from an instance of the object to the virtual function
- table, and __INDEX - 1 is the index into the vtable to use to
- find the function.
-
- The value to use for the THIS parameter is the address of the
- object plus __DELTA.
-
- For example, given:
-
- struct B1 {
- int i;
- };
-
- struct B2 {
- double d;
- void f();
- };
-
- struct S : public B1, B2 {};
-
- the pointer-to-member for `&S::f' looks like:
-
- { 4, -1, { &f__2B2 } };
-
- The `4' means that given an `S*' you have to add 4 bytes to get to
- the address of the `B2*'. Then, the -1 indicates that this is a
- non-virtual function. Of course, `&f__2B2' is the name of that
- function.
-
- (Of course, the exact values may differ depending on the mangling
- scheme, sizes of types, and such.).
-
- Under the new ABI, we do:
-
struct {
__P __pfn;
ptrdiff_t __delta;
};
- (We don't need DELTA2, because the vtable is always the first thing
- in the object.) If the function is virtual, then PFN is one plus
- twice the index into the vtable; otherwise, it is just a pointer to
- the function.
+ (As the vtable is always the first thing in the object, we don't
+ need an offset to it.) If the function is virtual, then PFN is one
+ plus twice the index into the vtable; otherwise, it is just a
+ pointer to the function.
Unfortunately, using the lowest bit of PFN doesn't work in
architectures that don't impose alignment requirements on function
#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)
#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
extern tree lookup_member PARAMS ((tree, tree, int, int));
extern int look_for_overrides PARAMS ((tree, tree));
extern void get_pure_virtuals PARAMS ((tree));
-extern tree init_vbase_pointers PARAMS ((tree, tree));
extern void get_vbase_types PARAMS ((tree));
extern void maybe_suppress_debug_info PARAMS ((tree));
extern void note_debug_info_needed PARAMS ((tree));