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 Wed, Nov 18, 2009 at 01:10:32PM -0500, Jason Merrill wrote:
> 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?

They do, but don't support e.g. jumping between functions with different TOC
etc.

>> 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.

If we switch callers, then we probably don't need any changes on the
definition side, we can keep it as is.

I'm now trying:
--- gcc/cp/call.c.jj	2009-11-18 15:48:50.000000000 +0100
+++ gcc/cp/call.c	2009-11-18 21:13:32.000000000 +0100
@@ -6044,6 +6044,14 @@ build_special_member_call (tree instance
 
   gcc_assert (instance != NULL_TREE);
 
+  if (!CLASSTYPE_VBASECLASSES (class_type))
+    {
+      if (name == base_ctor_identifier)
+	name = complete_ctor_identifier;
+      else if (name == base_dtor_identifier)
+	name = complete_dtor_identifier;
+    }
+
   fns = lookup_fnfields (binfo, name, 1);
 
   /* When making a call to a constructor or destructor for a subobject

(will of course add a comment).  This didn't regress check-g++ except for
one mangle*.C test which would need adjustment, trying to build libstdc++
now.

	Jakub


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