This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] - Fix PR 21956 and PR 22003


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;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]