Updated files
Coleen Phillimore
coleen at zko.dec.com
Thu Mar 30 00:28:27 UTC 2000
I attached my comments on construction vtables. I won't be able to
listen to the con-call tomorrow (and definitely not fly out).
Have fun,
Coleen
-------------- next part --------------
>From the ctorvtbls writeup:
> c.Ed. Note: Don't we need the equivalent of secondary vptrs here, too?
Yes, maybe it would be better to eliminate a,b,c and say in 2:
>2.Secondary VTTs: for each non-virtual subobject B of D, that requires a
> construction vtable by virtue of having virtual bases, a sub-VTT for
> B-in-D, which contains: <insert change color here> address in #1, #2, #3.
Note that step #2 is recursive on #1, #2 and #3. This might simplify
the description somewhat.
Then for #3 put the better sentence from 2b "Subobject A of B needs a
construction ..."
Note this changes the definition slightly. There is only a need for a
secondary VTT if the nonvirtual subobject has a virtual base (not if it
has an overridden virtual function). There is a need for the secondary ptr
in the VTT (step #3) if either the base has virtual base or overridden virtual
functions.
The example:
I changed the example slightly to add 'int' members to all the classes, so
there isn't so much sharing to confuse the issue. I also added 'virtual'
for member function 'f' which I think was intended. The example's hard to
follow, but I think it's mostly right, see my comments below.
>
> // 1. Primary vptr:
> D * has virtual bases
>
> // 2. Secondary VTTs:
> C1 * has virtual base
> V1-in-C1 in D secondary vptr
V1 is a virtual base class, so it's not in VTT
> A1-in-...-C2 in D secondary vptr
nonvirtual base in virtual base class V1, not in VTT
>
> C2 * has virtual bases
> V2-in-C2 in D secondary vptr *
> V1-in-V2-in-C2 in D secondary vptr *
Yes, this is right. V1 and V2 secondary vptrs for C2 need
construction vtables, because V2 has virtual bases and V1 has
virtual calls overridden on virtual path.
I think the nesting should be the same.
> A1-in-...-C2 in D secondary vptr *
This one is shared by V1, so not in VTT.
>
> // 3. Secondary vptrs:
> C1-in-D secondary vptr
This is shared with D, so not in VTT.
> V1-in-D secondary vptr *
> A1-in-V1-in-D secondary vptr (shared with V1)
> C2-in-D secondary vptr
> V2-in-D secondary vptr
>
> // 4. Virtual VTTs:
> (V1 can use complete object constructor).
> V2 * has virtual base, has overridden f()
> V1-in-V2 in D secondary VTT
> A1-in-V1 * has overridden f()
> V1-in-V2 in D secondary vptr
> A1-in-V1-in-V2 in D secondary vptr
>
I think this is right.
So, I have 10 entries in the VTT for D (ignore external names):
static const long *__VTT_1D[8] =
{__7__vtbl_1D, // primary complete vptr for D
// Secondary VTT for C1
__7__vtbl_2C1_2C1__1D, // construction vtbl for C1 in D
// Secondary VTT for C2
__7__vtbl_2C2_2C2__1D, // construction vtbl for C2 in D
__7__vtbl_2V2_2C2__1D, // construction vtbl for V2 in C in D
__7__vtbl_2V1_2C2__1D, // construction vtbl for V1 in C in D
// secondary vptrs for D
__7__vtbl_2C21D,
__7__vtbl_2V21D,
__7__vtbl_2V11D,
// virtual part
__7__vtbl_2V2_2V2__1D,
__7__vtbl_2V1_2V2__1D};
The red in the 'Subobject Construction and Destruction' section looks
fine.
Coleen
More information about the cxx-abi-dev
mailing list