lua-users home
lua-l archive

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

On Thu, 26 Jul 2001, Roberto Ierusalimschy wrote:

> the complexity of the compiler (Lua uses a one-pass compiler, without any
> form of intermediate representation). ET once gave an interesting
> sugestion, where "normal" local variables live in the stack, and only local
> variables that are used by inner-functions would be allocated in the heap.
> The problem is how to generate code without knowing where a variable is
> going to live (when the compiler sees the inner function it can be too
> late...)

Interesting.  Well, how about an *optional* optimizer, which takes in Lua
bytecode, looks for optimizations like that, and outputs the optimized
bytecode.  I don't know much about Lua internals... does that sound
feasible?  It seems like it could maybe be done as an external third-party

Re: tail calls... can the decision be made at the time of the recursive
call rather than at compile time?  It's been a while since I've worked on
anything like that so forgive me if I'm being stupid :)