Vcall/vbase offset clarification

Jim Dehnert dehnert at baalbek.engr.sgi.com
Wed Feb 16 04:08:58 UTC 2000


OK, maybe I've got this now.  I fixed the section on "Virtual Function
Calling Convention" in the ABI layout document, with the changes in
red.  Can someone check that my changes are right?  Also, since I
don't find the words from Mark quoted below, is there somewhere else
that needs to be changed?

Jim

> From jason at cygnus.com  Thu Feb 10 12:36:03 2000
> 
> >>>>> Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:
> 
>  >> From: Martin von Loewis <loewis at informatik.hu-berlin.de>
>  >> To: mark at codesourcery.com
>  >> 
>  >> > > From mitchell at codesourcery.com  Tue Jan 25 13:26:12 2000
>  >> > >   struct A { void f();}
>  >> > >   struct B : public virtual A {};
>  >> [...]
>  >> > >   o First, we convert to the most derived class in which `f' was
>  >> > >     overridden.  That's `A'.  We know statically what offset
>  >> > >     to adjust `b' by to get an `A*'.
>  >> 
>  >> Maybe you didn't mean it that way, but: How do we know statically the
>  >> offset needed to adjust a B* to an A*? Wouldn't we have to look in the
>  >> vtable at run time to fetch the vbase offset?
>  >> 
>  >> > >   o We pass this value to the function found in the vtable for `A'.
>  >> > > 
>  >> > >   o That function will first perform the constant adjustment from 
>  >> > >     `A' to `B'.  
>  >> 
>  >> Or perhaps that shouldn't have been virtual inheritance in the B
>  >> bases?
> 
>  > I think the right statement is 'we know statically how to adjust "b" to
>  > get an "A*".  If A is a non-virtual base, we know the offset
>  > statically.  If it is a virtual base, we know statically where to fetch
>  > the vbase offset in the vtable.'
> 
> No, I'm with Martin on this.  We're trying to adjust from A* to C*; the
> adjustment from B* to A* is not useful.
> 
> Jason
> 
-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list