Handling of the interrupted OP_TAILCALL instruction

83 views
Skip to first unread message

Jure Bagić

unread,
Nov 24, 2025, 11:05:30 PMNov 24
to lua-l
Just wondering if 'luaV_finishOp' relies on fall-through to the OP_RETURN
instruction in order to properly put results in correct place in case the
interrupted opcode is OP_TAILCALL (in case the called function is C and the
caller is Lua vararg function)?
(I see no other way, as 'default' case is empty.)
-- Jure
signature.asc

Roberto Ierusalimschy

unread,
Nov 27, 2025, 10:52:29 AMNov 27
to lu...@googlegroups.com
(I am not sure what you mean by "fall-through" here.) An OP_TAILCALL
is always followed by OP_RETURN. If OP_TAILCALL is interrupted, the
OP_RETURN will naturally be the next instruction to be executed and then
it will complete the task.

-- Roberto

Jure Bagić

unread,
Nov 27, 2025, 10:34:49 PMNov 27
to lu...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/20251127155221.GA36760%40arraial.inf.puc-rio.br.

I had some confusion because all of the other instructions that can be
interrupted get directly handled in the switch statement and the others in the
'default' case require nothing else to be done for them except the OP_TAILCALL.
Thanks for clarification.

-- Jure
signature.asc
Reply all
Reply to author
Forward
0 new messages