Escape Analysis on reddit

Sergey Gromov snake.scaly at gmail.com
Fri Nov 7 08:08:51 PST 2008


Sat, 1 Nov 2008 11:28:15 -0400, Steven Schveighoffer wrote:

> "Robert Fraser" wrote
>> Walter Bright wrote:
>>> Steven Schveighoffer wrote:
>>>> 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.
>>>
>>> Pushing things off to the linker is not practical because then you cannot 
>>> rely on standard, off-the-shelf linkers.
>>
>> Or dynamic ones.
> 
> Both good points.  Such is the requirement for a full analysis though, as 
> you don't always have all the source available, and if you have cyclic 
> dependencies, you have a chicken-and-egg problem.  But if this scope 
> proposal just makes D nightmarish, either with convoluted syntax or correct 
> code not compiling, it's still an option to think about.
> 
> As far as dynamic linkers, at least on windows, the DLL can have a routine 
> that resolves the graphs when loaded.   I'm not sure about shared objects 
> though...

Or there could be a separate tool, like verify in Java.  DLLs can be
handled, too, because every DLL must have an import library.  So it can
include an import escape graph as well.

Though there'll have to be an escape metal-language anyway to be able to
describe external APIs and dynamically loaded DLLs.  An image of
core.sys.windows.windows annotated to support escape analysis boggles my
mind.



More information about the Digitalmars-d mailing list