C++ vtable example
Jason Merrill
jason at cygnus.com
Fri Sep 3 01:21:53 UTC 1999
First, I'd like to propose again that the RTTI info move to negative
offsets, for COM compatibility.
I believe your D vtable is wrong; for starters, there's only one A vtable
in D. Also, calls through defining class vtables don't require adjustment;
you seem to have that backwards. My interpretation of Christophe's
proposal for this case:
D::offset_to_A (32)
D::offset_to_top (0)
D::rtti
-- D, B-in-D vtable address --
B::f() [0]
C::offset_to_A (16)
C::offset_to_top (-16)
C::rtti
-- C-in-D vtable address --
C::g() [0]
A::offset_to_top (-32)
A::rtti
-- A-in-D vtable address --
B::f() [offset at -80] -- change from A-in-B vtable, requires third-party thunk
C::g() [offset at -48]
-----------
For comparison, Brian's and my proposal would look like this:
D::offset_to_A (32)
D::offset_to_top (0)
D::rtti
-- D, B-in-D vtable address --
B::f() [0]
C::offset_to_A (16)
C::offset_to_top (-16)
C::rtti
-- C-in-D vtable address --
C::g() [0]
A::offset_for_g (-16)
A::offset_for_f (-32)
A::offset_to_top (-32)
A::rtti
-- A-in-D vtable address --
B::f() [offset at -24]
C::g() [offset at -32]
More information about the cxx-abi-dev
mailing list