[ Date Prev][ Date Next][ Thread Prev][ Thread Next][ Date Index][ Thread Index]
Re: vcall offset description
- To: cxx-abi@xxxxxxxxxxxxxxxxxxxx, Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
- Subject: Re: vcall offset description
- From: dehnert@xxxxxxxxxxxxxxxxxxxx (Jim Dehnert)
- Date: Tue, 4 Apr 2000 12:52:37 -0700 (PDT)
> From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
>
> I noticed some red ink in the vcall offset description:
>
> Virtual call (vcall) offsets are used to perform pointer adjustment
> for virtual functions defined in a virtual base class or its
> subobjects, and overridden in a class derived from it.
>
> I think we need the vcall offsets even if the function is not
> overridden. Otherwise, when the same base appears as a virtual base
> in two different hierarchies, its vtable layout might be different.
> Then, if a single hierarchy combines both uses, everything will get
> confused. So, I think the last clause (`and overridden ...') should
> go. Sound right?
Yes and no. This sentence describes what vcall offsets are and how
they are used, and is correct -- they are not used unless the virtual
function is actually overridden. Later, the virtual table layout
description for Category 3 describes what entries are present:
... the vtable for a virtual base A also includes a
vcall offset entry for each virtual function represented in A's
primary vtable and the secondary vtables from A's non-virtual bases.
The vcall offset entries are allocated from the inside out, in the
same order as the functions appear in A's vtables.
So the vcall offsets are present, as you understood, for all vptrs,
whether or not overridden (and therefore used).
The confusion stems from our separation of the description of vtable
components and order from the description of exactly what is contained
in various vtables. I'm reluctant to remove that separation, because I
think it allows each part to be clearer -- but it certainly means that
you can't read just one section and understand. I'll try to clarify
that in the introductory paragraph.
Jim
- Jim Dehnert dehnert@xxxxxxx
(650)933-4272
|