lua-users home
lua-l archive

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


On Fri, Oct 20, 2000 at 12:21:40AM -0000, Sebby  wrote:
> Another solution would be to modify the Lua VM so it works in an 
> iterative manner instead of recursive. I tried implementing that 
> approach last weekend and had some (but limited) success. I basicly 
> modified the VM function so it would push it's state (mostly the 
> variables it received in parameter) into a memory buffer when i 
> entered the VM and poping them when i was supposed to go out. Just 
> looping inside the VM. Now, this has it's own set of problems. First 
> of all, the is some code to modify in lots of places if you want to 
> account all the special cases. Another case that is annoying to 
> handle is the case of CClosures which call Lua functions (foreach is 
> a good example). I got my thing to work for all test in the lua 
> archive except 2 (trace-globals and factorial) but the problem 
> somehow seems related with the use of the % operand.

The thing you have to recognize is that you don't need to eliminate the
recursion in all of the special cases to get what you want.  Please see the
details in the post I just made to the list-thread "Lua and light threads".

Bret
-- 
Bret Mogilefsky  ** mogul@playstation.sony.com **  Programmer, SCEA R&D