Virtual base class offsets in vtables

Mark Mitchell mark at codesourcery.com
Tue Jan 18 18:34:34 UTC 2000


>>>>> "Jason" == Jason Merrill <jason at cygnus.com> writes:

    >> o Furthermore, it's unclear whether or not offsets for indirect
    >> virtual bases should be stored.  The Category 3 description
    >> seems to indicate that only *direct* bases should be stored;
    >> otherwise left-to-right declaration order isn't really
    >> well-defined.  But, Category 4 clearly says direct or indirect
    >> bases.

    Jason> The idea is to promote vbase offsets, like virtual function
    Jason> entries, out of virtual bases and not non-virtual bases.

I'm not sure I understand.  But, let's see if this is what we want:

  For a primary vtable, there is exactly one vbase offset entry for
  each direct and indirect virtual base class.  The order in which
  these entries appear in the vtable is in the reverse order of the
  order in which the virtual bases are encountered in a left-to-right
  depth-first traversal of the inheritance heirarchy.  In other words,
  the offset for the first base encountered on the traversal is stored
  closest to the point where the vptr will point.

  For an S-as-T vtable, the vbase offset entries from the primary
  vtable for T are replaced with appropriate offsets given the
  completed hierarchy.

I think that's a uniform definition that should cover both Category 3
and Category 4.

    Jason> I'm not sure what you mean by "present in the primary
    Jason> vtable".

OK -- I tried to clarify this in the indented second pargraph above.

Thanks for your feedback,

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




More information about the cxx-abi-dev mailing list