Vtables

Coleen Phillimore coleen at zko.dec.com
Mon Feb 21 14:19:32 UTC 2000


Mark Mitchell wrote:
> 
> Folks --
> 
>   The ABI appears to specify that the secondary vtables immediately
> follow the primary vtables for a class.  However, the order is
> unclear:
> 
> 7.The secondary vtables are last. They are laid out in the same order used for the bases themselves in the object.
> 
>   That's not well-defined since two bases may lay at the same offset.
> Let's just say `in the order given by a left-to-right depth-first walk
> of the inheritance graph', assuming that there's not some deep reason
> behind the current wording.
> 
>   Agreed?

In the construction vtables section, I suggested the same ordering as #7
for nonvirtual bases at least, since there's a one-to-one relationship
between vptrs and vtables for a derived class.  If two bases are at the
same offset, they share the same vtable.

The trouble that I have with the left-to-right wording is that if you have
an nearly empty virtual base class that shares a vptr with a subobject
in the class, the vtable would be coincident with the shared subobject vtable,
and not allocated at the end of the vtable array (in it's left-to-right
position).  Just like in the base class layout algorithm itself.

Coleen

> 
> --
> Mark Mitchell                   mark at codesourcery.com
> CodeSourcery, LLC               http://www.codesourcery.com

-- 
-----------------------------------------------------------------------
Coleen Phillimore                  | mailto:coleen at zko.dec.com
Compaq Computer Corp.   Nashua, NH | COMPAQ C++ Compiler Development
-----------------------------------------------------------------------




More information about the cxx-abi-dev mailing list