lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy <rieru@delirius.cs.uiuc.edu> writes:

> On 3 Oct 2001, John D. Ramsdell wrote:

> > 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 ;-)

Ha, yes, I forgot you were using a mark-sweep collector.

> 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.

Please read my remarks with the assumption that I have read only
selected portions of the 4.1 alpha source code, so my comments may be
off base.  All I was trying to point out is that, if one knew which
variables required heap storage before all code generation begins, one
could implement nested scoping with less overhead at runtime, however,
given the commitment to a that garbage collector already keeps track
of all the closures, the overhead does seems small.

John