New memory management strategy

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 24 23:33:15 PDT 2017


On Sunday, 25 June 2017 at 05:29:02 UTC, Axe wrote:
> Since we cannot find the control flow path in a function. All 
> the variable
> declarations are moved to the top of the function, so that 
> control flow doesn't determine whether
> the variables are allocated or not.
>
> Now the question is whether this is correct/practical or not?

Backends generally do things like this, i.e. reusing locations on 
the stack when the variables on it are no longer alive, although 
you don't actually have to stack allocate anything when you don't 
call other functions since then you don't have to figure out how 
much space you need on the stack. So you can just use the whole 
stack as a scratchpad if you want to.

https://en.wikipedia.org/wiki/Live_variable_analysis



More information about the Digitalmars-d mailing list