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: [LTO] Fix C++ thunks


Diego Novillo wrote:
> [ CCing jason and mark, to make sure I'm not missing anything
>   obvious in the C++ side. ]
> 
> This patch is the initial step to make thunks work with LTO.
> Essentially, this forces cc1plus to always emit non-asm thunks,
> which is a performance problem, but I think I know how to address
> it.

I think your patch is plausible.  Obviously, we need to get the asm
thunks back in to recover performance (and correctness, for varargs).  I
think GIMPLE_THUNK_CALL is a plausible solution to that.

A few things you should think about:

1. Although we've never implemented it, one of the ideas with thunks was
that you could fall through into the main function body, rather than
jump to it.  That avoids a costly, often mis-predicted branch.  So, we
shouldn't do anything that makes that harder.

2. Thunks (whether or not implemented as fall-throughs) can be thought
of as alternate entry points.  You might want to think about whether
GIMPLE_THUNK_CALL is the right long-term representation, or whether what
we should really be doing is adding alternate entry point support, which
is of course useful for other things as well.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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