pub struct Frame {
pub closure: Gc<LuaClosure>,
pub base: u32,
pub pc: u32,
pub func_slot: u32,
pub n_varargs: u32,
pub nresults: i32,
pub hook_oldpc: u32,
pub from_c: bool,
pub tm: Option<&'static str>,
pub is_hook: bool,
pub tailcalls: u32,
}Expand description
An activation record on a thread’s call stack. Pure data (closure handle +
stack offsets), so it lives in runtime where the GC can trace a suspended
coroutine’s frames.
Fields§
§closure: Gc<LuaClosure>Currently executing closure.
base: u32stack index of register 0
pc: u32Program counter (index into closure.proto.code).
func_slot: u32stack slot of the function (results land here)
n_varargs: u32number of extra (vararg) arguments, living on the stack just below base
at func_slot+1 .. func_slot+1+n_varargs (PUC CallInfo.u.l.nextraargs).
OP_VARARG/OP_VARGIDX read them there; a named vararg only materializes
a heap table when it is written / escapes / is _ENV.
nresults: i32results expected by the caller (-1 = all)
hook_oldpc: u32pc the line hook last observed in this frame (PUC CallInfo oldpc);
u32::MAX on a fresh frame so its first instruction fires a line event
from_c: booltrue if this Lua frame was entered across a C boundary (call_value: a
metamethod, pcall, __close handler, or a coroutine body). Debug level
traversal (debug.getinfo/traceback) inserts a synthetic C frame below it.
tm: Option<&'static str>the metamethod event this frame is handling (e.g. “close” for a __close
handler call), so debug.traceback/getinfo can name it “metamethod
‘close’” (PUC CallInfo.u.l.tm/luaG_funcnamefromtm).
is_hook: booltrue when this frame is the hook function itself (PUC sets
CIST_HOOKED). debug.getinfo(1).namewhat returns "hook" for it.
tailcalls: u32PUC ci->u.l.tailcalls — how many tail calls have collapsed into
this activation slot. Each OP_TailCall chain adds one. 5.1
lua_getstack reports a synthetic CIST_TAIL level per count
(so a deeply tail-recursive function shows tailcalls extra
levels between itself and its real caller — 5.1 db.lua :372 walks
getinfo(2..lim) and expects each to be "tail"). The 5.2+
istailcall boolean is tailcalls > 0.