Thunk error in specification
Mark Mitchell
mark at codesourcery.com
Thu Oct 31 19:47:34 UTC 2002
Section 3.2.3 of the ABI specification indicates what thunks should be
emitted with a particular function.
While constructing our ABI testsuite, we have noticed a problem
with this language:
For each direct or indirect virtual base V of C such that either V
declares f, or is derived from a class that declares f, the compiler
must emit, in the same object file as the code for C::f, a
V-adjusting entry point for C::f.
This sentence should be revised to remove the "or is derived from a class
that declares f" clause. An example of where this matters is:
struct A { virtual void f(); };
struct B { virtual void g(); };
struct C : public A, public B { }:
struct D : virtual public C { virtual void g(); };
There is no point in creating a C::g thunk to convert from a C* to a
D* since C's vtable will not contain an entry for g. (You do, of
course, need a thunk that converts from a B* to a C*, and then
adjusts by using the appropriate vcall offset in C's virtual table.)
(This language is a hold-over from an earlier draft of the ABI where
C's vtable *did* have an entry for g.)
As a result of removing the clause mentioned above, this language in the
next paragraph should also be removed:
(Note that one implementation of the M-adjusting entry point is to
convert from M* to V* and then transfer control to the V-adjusting
entry point.)
There is no longer any guarantee that the V-adjusting entry point exists.
I will make this change in a couple of days, unless anyone objects.
--
Mark Mitchell mark at codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the cxx-abi-dev
mailing list