Possible quick win in GC?

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 28 13:20:28 PDT 2014


On Sunday, 28 September 2014 at 16:29:45 UTC, Abdulhaq wrote:
> I got the idea after thinking that it should be fairly simple 
> for the compiler to detect straightforward cases of when a 
> variable can be declared as going on the stack - i.e. no 
> references to it are retained after its enclosing function 
> returns.

LDC does the "fairly simple" part of this already in a custom 
LLVM optimizer pass. The issue is that escape analysis is fairly 
hard in general, and currently even more limited because we only 
do it on the LLVM IR level (i.e. don't leverage any additional 
attributes like scope, pure, … that might be present in the D 
source code).

David


More information about the Digitalmars-d mailing list