[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Function void luaV_finishOp (lua_State *L)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 9 Dec 2014 10:00:55 -0200
> I had not thought along that direction. However, I see luaV_finishOp() is
> not a heavily reused function. It seems only be hit through
>
> lua_resume -> resume -> unroll -> luaV_finishOp
>
> So I'm not sure whether the case about meta-table or debug-hook is really
> applied. Seems unlikely. Maybe I'm wrong.
It may be "unlikely", but an implementation must support unlikely
events just the same...
Actually, debug-hook does not need luaV_finishOp, because it can only
happens between opcodes. The real problem are metamethods. When a
metamethod yields, it interrupts the execution of its corresponding
opcode. Then, when we resume the thread later, the sequence lua_resume ->
resume -> unroll -> luaV_finishOp happens to complete the interrupted
opcode. Note that all opcodes handled by luaV_finishOp either do
a call (OP_TFORCALL, OP_CALL, OP_TAILCALL) or can call metamthods.
-- Roberto