[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: implementation of lexical scoping
- From: Roberto Ierusalimschy <rieru@...>
- Date: Wed, 3 Oct 2001 10:13:44 -0500 (CDT)
On 3 Oct 2001, John D. Ramsdell wrote:
> The alternative is to perform a two-pass compilation when
> generating bytecode, and during the first pass, mark local variables
> accessed by nested functions as requiring heap allocation. The second
> pass can generate efficient closures that allocate most of their local
> variables on the stack.
I did not understand that. The current implementation already allocate all
their local variables on the stack, initially. Only when there is no other
way (that is, that variable is going out of scope and it is used by some
other closure) the variable goes to the heap.
> I hope the open references list does not take up too much space.
No space at all. It is a linked list. We already have a list of all
closures (for GC), so we just keep open references in a separate list.
(Well, it takes an extra "root" in lua_State ;-)