What's the go with the GC these days?

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Jan 6 07:31:08 UTC 2019


On Sunday, 6 January 2019 at 06:57:40 UTC, Walter Bright wrote:
> On 1/5/2019 8:34 PM, H. S. Teoh wrote:
>> Of course, it's possible for Java compilers to optimize away 
>> some
>> allocations if object lifetimes can be statically determined 
>> -- I don't
>> know if any Java compilers actually do this.
>
> They do. I forgot the jargon term for it, but they'll determine 
> if the lifetime does not escape the function scope, and 
> allocate it on the stack instead of the heap.

Heap to stack promotion? BTW LDC does this 
https://github.com/ldc-developers/ldc/blob/master/gen/passes/GarbageCollect2Stack.cpp


More information about the Digitalmars-d mailing list