This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C++ space optimization: de-cloning con/de/structors
- From: Jason Merrill <jason at redhat dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: Stuart Hastings <stuart at apple dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 08 Aug 2002 09:52:00 +0100
- Subject: Re: [PATCH] C++ space optimization: de-cloning con/de/structors
- References: <F4FFDFA6-AA70-11D6-8654-000393941EE6@apple.com>
On Wed, 7 Aug 2002 18:48:37 -0700, Mike Stump <mrs@apple.com> wrote:
> On Wednesday, August 7, 2002, at 05:41 PM, Jason Merrill wrote:
>> Similarly, in the case of the decloning thunks, the compiler is not
>> allowed to add new copy constructor calls. So this is a correctness
>> issue, not just an optimization.
>
> Doesn't the latitude in:
>
> 12.2 Temporary objects [class.temporary]
>...
> Here, an implementation might use a temporary in which to construct
> X(2) before passing it to f() using X's copy-constructor; alterna-
> tively, X(2) might be constructed in the space used to hold the argu-
> ment.
>
> cover this case?
No, it doesn't. It doesn't give us the latitude to copy the object again
*after* passing it to f().
>> Why not? These objects, created by copy constructors, are passed to the
>> thunk by invisible reference.
>
> They are? Why do you think that? I believe in the code stuart submitted,
> that in fact they are not on darwin.
Dude, I'm talking about basic ABI stuff here. A type with a non-trivial
copy constructor has TREE_ADDRESSABLE set, and therefore is passed by
invisible reference.
Jason