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] Also optimize DECL_ONE_ONLY cdtors (PR c++/3187)


On 11/18/2009 01:03 PM, Jakub Jelinek wrote:
On Wed, Nov 18, 2009 at 11:24:18AM -0500, Jason Merrill wrote:

What if we just make one jump to the other?

That is only possible on some targets (the ones that allow to do a tail call to that kind of function), on other targets you'd need to call it and return and in case of ... arguments just give up.

Not all targets have unconditional branches?


It would also be more expensive at runtime, the call takes some cycles.

Indeed. One possibility would be for callers to switch to using the primary symbol since we know they're identical; then we wouldn't need to emit a definition of the other one at all.


But most importantly, the jump/call would essentially become part of the
ABI.  Because if say G++ 4.5 decides it jumps from *D1* to *D2* and some other
compiler decides to jump from *D2* to *D1*, then if the linker chooses
*D1* comdat group compiled by G++ 4.5 and *D2* comdat group compiled by the
* other compiler, those routines will jump to each other in an endless loop.

Yes, I figured that the choice of which is the main one would go into the ABI.


Jason


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