This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] ctor vtable vcall offsets
- To: jason at redhat dot com
- Subject: Re: [C++ PATCH] ctor vtable vcall offsets
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 27 Feb 2001 10:26:47 -0800
- Cc: nathan at codesourcery dot com, gcc-patches at gcc dot gnu dot org
- Organization: CodeSourcery, LLC
- References: <u9snl0ktxf.fsf@casey.cambridge.redhat.com>
>>>>> "Nathan" == Nathan Sidwell <nathan@codesourcery.com> writes:
3.2.4 Caller
When calling a virtual function f, through a pointer of static type
B*, the caller
* Selects a (possibly improper) subobject A of B such that A
declares f. (In general, A may be the same as B.) (Note that A
need not define f; it may contain either a definition of f, or a
declaration of f as a pure virtual function.)
* Converts the B* to point to this subobject. (Call the resulting
pointer `a'.)
* Uses the virtual table pointer contained in the A subobject to
locate the function pointer through which to perform the call.
* Calls through this function pointer, passing `a' as the this
pointer.
I think that's a little imprecise. (I wrote that language, so I can
safely criticize it...)
I think that `declares f' was supposed to mean `has an entry for f in
its vtable'. For example, given:
struct S { virtual void s(); };
struct T { virtual void t(); };
struct U : public S, public T {};
U* up = new U;
up->t();
You have to convert `up' to `T*' so that you can find an entry for
`t'.
I think your literal reading is correct though.
*My* beef with the thunk generation scheme (as you know :-) ) was that
we didn't just generate thunks everywhere, in COMDAT, and then allow
implementations to DTRT by generating an overriding strong symbol.
Bizarre SCO linkers aside, I still like that solution best...
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com