lua-users home
lua-l archive

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




2014-12-08 13:40 GMT-08:00 Coda Highland <chighland@gmail.com>:
On Mon, Dec 8, 2014 at 1:15 PM, Rena <hyperhacker@gmail.com> wrote:
> On Mon, Dec 8, 2014 at 2:05 PM, Dong Feng <middle.fengdong@gmail.com> wrote:
>> I'm trying to understand the following function.
>>
>> void luaV_finishOp (lua_State *L)
>>
>>
>> The comments say it is to resume an instruction interrupted by a previous
>> yield. In its implementation, there is a switch-case for a varieties of
>> instruction types (ADD, SUB, etc.).
>>
>> To my very limited understanding, I see only one possible code path being
>> hit, that is, the OP_CALL. Because an execution is always interrupted by a
>> call to coroutine.yield(). How come there are so many handling paths?
>>
>> I think my understanding is quite limited so I must miss many things here.
>> Just don't know what I missed. Thank you in advance.
>>
>> Dong
>>
>
> Just a hunch: they might also be interrupted by debug hooks?

I was thinking metamethods -- I don't think those get processed through OP_CALL.

/s/ Adam


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.

Dong