[PATCH] - Fix PR 21956 and PR 22003

Caroline Tice ctice@apple.com
Fri Jul 29 23:47:00 GMT 2005


Thanks!  I'll take a look at this...

-- Caorline

On Jul 29, 2005, at 4:32 PM, Ian Lance Taylor wrote:

> Caroline Tice <ctice@apple.com> writes:
>
>
>> Sorry I didn't answer this sooner; I've gotten a little behind on
>> reading the gcc mailing list.  I don't really understand how
>> what exactly a thunk is in gcc, so it's hard for me to answer your
>> question.  Hot/cold partitioning only changes from one section to
>> another if it encounters a note telling it to, and the note can only
>> be inserted if there are basic blocks, so it seems to me by default
>> that the thunk should land in the same section as the function.
>> But I'm not making any guarantees at this point.  if you could
>> give me a  thunk to test things with, I could give you a better
>> answer...
>>
>
> Thunks are used for goofy cases involving multiple inheritance, in
> which we have to adjust the 'this' pointer when calling a virtual
> function defined in a subclass.  (There may be other cases where
> thunks are used, but that is one).
>
> Compiling this code with the C++ compiler should give you a thunk
> named something like _ZThn4_N1E2fnEv.  It will adjust the 'this'
> pointer and then jump to E::fn() (_ZN1E2fnEv).
>
> Ian
>
> class A
> {
> public:
>   virtual int fn();
> };
>
> class C : public A
> {
> public:
>   virtual int fn();
> };
>
> class D : public A
> {
> public:
>   virtual int fn();
> };
>
> class E : public C, D
> {
>   virtual int fn();
> };
>
> int
> E::fn()
> {
>   return 0;
> }
>



More information about the Gcc-patches mailing list