[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT roadmap 2008 question
- From: Mike Pall <mikelu-0911@...>
- Date: Mon, 2 Nov 2009 14:40:14 +0100
> If the errfunc is stored in C stack, the pcall is non-resumable. That
> is it doesn't allow yield across it. Is my understanding correct?
We're talking about lua_pcall(). This sets up a FRAME_CP and
that's not resumable indeed.
But pcall() and xpcall() (the Lua library functions) don't use it.
They set up a FRAME_PCALL/FRAME_PCALLH (*). And xpcall() in
particular flips its first two arguments, so the error function is
left below the callee.
If an error is thrown, the frames are traversed backwards to find
the innermost error function. The size of the pcall frame (1 or 2)
is used to distinguish betwen pcall() and xpcall(). In the latter
case the error function is fetched from below the callee frame.
(*) The FRAME_PCALLH variant is used when hooks are blocked before
the pcall(). I had no bit left anywhere to store this info.