[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT roadmap 2008 question
- From: Mike Pall <mikelu-0911@...>
- Date: Sun, 1 Nov 2009 18:06:38 +0100
CHU Run-min wrote:
> I found it doesn't consider C func's frame size. In standard Lua
> implementation, the func's frame size is recorded in CallInfo' top
> field. But in LJ2, there is no space to record the frame size of C
Correct. But there is no need to record the size of a C function
[BTW: Congratulations on your grasp of the internals of the code!]
> It seems harmful, isn't it? Or my misunderstanding. May Mike Pall
> reveal the mystery about this?
C functions can only use the lua_*() API functions to access the
stack. But LJ2 uses auto-sizing of the stack (see incr_top(L)) and
mostly ignores lua_checkstack(). As I explained in another thread
this is a) simpler, b) less error prone and c) has no negative
The peculiar marking problem with the re-appearing stack slots
can't happen for C function frames because they do not have a
fixed-size top. A return back to them always reduces top to the
last valid slot. Bulk-incrementing top with lua_settop() always
sets the new slots to nil.
BTW: that particular GC issue was the main reason why I switched
to auto-sizing of the stack for the Lua/C API.