pub struct CallInfo {
pub func: StackIdx,
pub top: StackIdx,
pub previous: Option<CallInfoIdx>,
pub next: Option<CallInfoIdx>,
pub u: CallInfoFrame,
pub u2: CallInfoExtra,
pub nresults: i16,
pub callstatus: u16,
pub call_metamethods: u8,
}Expand description
Saved state for a Lua or C call frame.
types.tsv: CallInfo → CallInfo (several fields renamed / adapted).
The C intrusive doubly-linked list (previous, next as raw pointers) is
replaced by Option<CallInfoIdx> indices into LuaState::call_info.
Fields§
§func: StackIdx§top: StackIdx§previous: Option<CallInfoIdx>§next: Option<CallInfoIdx>§u: CallInfoFrame§u2: CallInfoExtra§nresults: i16§callstatus: u16§call_metamethods: u8Lua 5.5: number of __call metamethods traversed before entering this
frame. Upstream stores this in the repacked 5.5 callstatus bits; keep
it separate here so older transfer/recover-status bits stay unchanged.
Implementations§
Source§impl CallInfo
impl CallInfo
pub fn is_lua(&self) -> bool
pub fn is_lua_code(&self) -> bool
Sourcepub fn is_vararg_func(&self) -> bool
pub fn is_vararg_func(&self) -> bool
Whether the active function is a vararg function.
Currently returns false unconditionally — vararg introspection via
debug.getinfo reports no vararg info instead of panicking.
TODO(port): wire when CallInfo carries proto access for vararg detection.
Sourcepub fn saved_pc(&self) -> u32
pub fn saved_pc(&self) -> u32
Index of the next bytecode instruction on this Lua frame.
debug_assert! guards that the frame is a Lua frame, restoring the
wrong-variant tripwire the pre-flatten enum gave for free.
Sourcepub fn set_saved_pc(&mut self, pc: u32)
pub fn set_saved_pc(&mut self, pc: u32)
Write the next-instruction index on this Lua frame.
Sourcepub fn nextra_args(&self) -> i32
pub fn nextra_args(&self) -> i32
Count of extra varargs collected at entry on this Lua frame.
Sourcepub fn set_nextra_args(&mut self, n: i32)
pub fn set_nextra_args(&mut self, n: i32)
Write the extra-vararg count on this Lua frame.
pub fn transfer_ftransfer(&self) -> u16
pub fn transfer_ntransfer(&self) -> u16
Sourcepub fn set_trap(&mut self, t: bool)
pub fn set_trap(&mut self, t: bool)
Set or clear the per-frame hook trap, stored in callstatus bit
CIST_TRAP (T2-C2 moved it out of the CallInfoFrame payload). Only
Lua frames are ever trapped: set_traps guards on is_lua() before
calling here, and trace_call/trace_exec operate on the current Lua
frame. The debug_assert! preserves that invariant. Reusing a slot for
a new call clears the bit via the callstatus = mask write in
prep_call_info, exactly as the old full-variant store reset trap.
Sourcepub fn trap(&self) -> bool
pub fn trap(&self) -> bool
Read the per-frame hook trap from callstatus bit CIST_TRAP. One mask,
no enum-discriminant branch — this is the hot read in the OP_CALL /
OP_RETURN updatetrap paths.
Sourcepub fn recover_status(&self) -> i32
pub fn recover_status(&self) -> i32
Read the 3-bit recover-status field packed into bits 10-12 of callstatus.
Sourcepub fn set_recover_status<T: Into<i32>>(&mut self, status: T)
pub fn set_recover_status<T: Into<i32>>(&mut self, status: T)
Write the 3-bit recover-status field. status must fit in three bits.
pub fn get_oah(&self) -> bool
Sourcepub fn set_oah(&mut self, allow: bool)
pub fn set_oah(&mut self, allow: bool)
Store the current allowhook value into callstatus bit 0 (CIST_OAH).
Sourcepub fn u_c_old_errfunc(&self) -> isize
pub fn u_c_old_errfunc(&self) -> isize
Saved errfunc to restore on pcall recovery (C-call frame).
debug_assert! guards that the frame is a C frame, restoring the
wrong-variant tripwire the pre-flatten enum gave for free.
Sourcepub fn u_c_k(&self) -> Option<LuaKFunction>
pub fn u_c_k(&self) -> Option<LuaKFunction>
Continuation function on a C-call frame.
Sourcepub fn set_u_c_k(&mut self, k: Option<LuaKFunction>)
pub fn set_u_c_k(&mut self, k: Option<LuaKFunction>)
Set continuation function on a C-call frame.
debug_assert! guards that the frame is a C frame (callers reach here
from lua_callk/lua_pcallk, where L->ci is the calling C builtin’s
frame).
Sourcepub fn set_u_c_ctx(&mut self, ctx: isize)
pub fn set_u_c_ctx(&mut self, ctx: isize)
Set continuation context on a C-call frame.
Sourcepub fn set_u_c_old_errfunc(&mut self, old_errfunc: isize)
pub fn set_u_c_old_errfunc(&mut self, old_errfunc: isize)
Set saved old_errfunc on a C-call frame.
Sourcepub fn set_u2_funcidx(&mut self, idx: i32)
pub fn set_u2_funcidx(&mut self, idx: i32)
Set the u2.funcidx field, used by yieldable pcall for error recovery.