pub struct CallInfoFrame {
pub savedpc: u32,
pub nextraargs: i32,
pub k: Option<LuaKFunction>,
pub old_errfunc: isize,
pub ctx: isize,
}Expand description
Payload of CallInfo.u.
C 5.4 declares this as an anonymous union with a Lua-frame member (l)
and a C-frame member (c); which member is live is implied by the
CIST_C callstatus bit. T2-C2 flattened the previous 2-variant Rust enum
into this branch-free struct: all fields are always present, so the hot
accessors (saved_pc, set_saved_pc, nextra_args) are plain field
reads with no discriminant test. The C-frame fields (k, old_errfunc,
ctx) are only meaningful on C frames; the Lua-frame fields (savedpc,
nextraargs) only on Lua frames. Accessors carry debug_assert!s on the
frame kind that replace the old enum’s wrong-variant panic tripwire at
zero release cost. The trap flag that used to live in the Lua variant
now lives in callstatus bit CIST_TRAP.
Layout: u32 + i32 + Option<fn> + isize + isize = 32 B (8-byte aligned),
identical to the previous enum payload, so CallInfo stays 72 B.
Fields§
§savedpc: u32Lua-frame: index of the next bytecode instruction. C: u.l.savedpc.
types.tsv: CallInfo.u.l.savedpc → u32
nextraargs: i32Lua-frame: count of extra varargs collected at entry. C: u.l.nextraargs.
types.tsv: CallInfo.u.l.nextraargs → i32
k: Option<LuaKFunction>C-frame: continuation function for a yieldable C call. C: u.c.k.
types.tsv: CallInfo.u.c.k → Option<lua_KFunction>
old_errfunc: isizeC-frame: saved errfunc to restore on pcall recovery. C: u.c.old_errfunc.
types.tsv: CallInfo.u.c.old_errfunc → isize
ctx: isizeC-frame: continuation context. C: u.c.ctx.
types.tsv: CallInfo.u.c.ctx → isize
Implementations§
Source§impl CallInfoFrame
impl CallInfoFrame
Sourcepub fn c_default() -> Self
pub fn c_default() -> Self
Default C-call frame: no continuation, zero context. The Lua-frame fields are benignly zeroed so any latent read on a misclassified frame reads the same value the old C variant produced.
Sourcepub fn lua_default() -> Self
pub fn lua_default() -> Self
Default Lua-call frame: pc=0, no extra args. The C-frame fields are
benignly zeroed to exactly the values c_default produced, so a Lua
frame that is later reclassified or read as a C frame sees identical
defaults to the pre-flatten enum (which carried no C fields). The
trap flag now lives in callstatus bit CIST_TRAP, cleared by the
callstatus write in prep_call_info, not here.
Trait Implementations§
Source§impl Clone for CallInfoFrame
impl Clone for CallInfoFrame
Source§fn clone(&self) -> CallInfoFrame
fn clone(&self) -> CallInfoFrame
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more