<p dir="ltr"><br>
On Aug 1, 2014 5:55 AM, "Arnaud A. de Grandmaison" <<a href="mailto:arnaud.degrandmaison@arm.com">arnaud.degrandmaison@arm.com</a>> wrote:<br>
><br>
> I do not think this can apply to "C-only", as C has no way to express unnamed temporaries (language lawyers may contradict me here ;)</p>
<p dir="ltr">Write a c function that returns a large struct by value and another with that type as a parameter and call the later with the result of the former?</p>
<p dir="ltr">struct big source(void);<br>
void sink(struct big);</p>
<p dir="ltr">sink(source ());</p>
<p dir="ltr">Should get you some anonymous stack usage in c that you can optimize the use of.</p>
<p dir="ltr">> On the other hand for C++, you can have lots of those unnamed temporaries.<br>
><br>
> A possible path, along the line of what you suggest, would be to activate lifetime markers only in the non-throwing cases (or when compiled with -fno-exceptions). The exceptional part could come later.<br>
><br>
> We could at least get some of the benefits now.<br>
><br>
> Cheers,<br>
> Arnaud<br>
><br>
><br>
> -----Original Message-----<br>
> From: Renato Golin [mailto:<a href="mailto:renato.golin@linaro.org">renato.golin@linaro.org</a>]<br>
> Sent: 01 August 2014 13:26<br>
> To: Arnaud De Grandmaison<br>
> Cc: Clang Dev<br>
> Subject: Re: [cfe-dev] Adding lifetime begin/end to unnamed temporaries<br>
><br>
> On 31 July 2014 17:59, Arnaud A. de Grandmaison <<a href="mailto:arnaud.degrandmaison@arm.com">arnaud.degrandmaison@arm.com</a>> wrote:<br>
> > By the way, my patch indeed also affected some debuginfo (some<br>
> > breakpoint location if I remember correctly). I have switched<br>
> > temporarily to something else, but this patch proved to be extremely<br>
> > complex --- complexity linked to what you can find in the thread about<br>
> > temporary destructors. There is something going wrong in how the<br>
> > scopes are handled and my patch triggers it. I am probably breaking<br>
> > some undocumented or implicit assumptions. But there is definitely a<br>
> > lot of potential to reduce stack usage, and we saw that on real code.<br>
><br>
> This might be a bad idea, but is it possible to start with a C-only implementation, and move on with C++ later? At least we can get the general implementation right, and then only fiddle with exception handling when we need to.<br>
><br>
> cheers,<br>
> --renato<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</p>