Escape Analysis on reddit

Steven Schveighoffer schveiguy at yahoo.com
Fri Oct 31 19:47:59 PDT 2008


"Walter Bright" wrote
> Robert Fraser wrote:
>> I think Steven's point was that these programs are not the few; they're 
>> the many. Most fairly large programs will have issues like this one.
>
> I'm not sure that's the case, or if it is, those programs will suffer 
> significantly from using an alternative (the most obvious alternative is 
> to allocate those particular cases on the heap).

Yes, my point in all this is, if we are going to 'solve' the scope escape 
issue which today causes unnecessary heap allocations, let's not make new 
syntax that makes things harder or impossible to do and *still* have the 
heap allocation problem.

> Consider the other problem. It's not easy for a human to look at Steven's 
> case and verify that it is correct. A small mistake in it, and it isn't 
> correct anymore. What's it worth to be rid of such problems?

It's worth a lot, I agree.  But not at the cost of invalidating tested 
efficient designs such as Tango.

FWIW, I think with changes to the compiler/linker, this can be all detected 
automatically without any extra syntax.  Consider that the linker currently 
resolves dependencies of symbols.  It could also resolve incomplete escape 
analysis graphs.  If the graphs don't match up, it's a linker error.  This 
would be needed in the case of interfaces and virtual functions.

That would be the ultimate solution IMO, but definitely not in time for D2 
;)

-Steve 





More information about the Digitalmars-d mailing list