This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [LTO] Fix C++ thunks
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Diego Novillo <dnovillo at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Jason Merrill <jason at redhat dot com>
- Date: Wed, 17 Dec 2008 10:04:39 -0800
- Subject: Re: [LTO] Fix C++ thunks
- References: <20081217173334.GA9561@google.com>
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