[PATCH] C++ space optimization: de-cloning con/de/structors
Jason Merrill
jason@redhat.com
Thu Aug 8 01:52:00 GMT 2002
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
More information about the Gcc-patches
mailing list