Skip to main content

Module exec

Module exec 

Source
Expand description

The interpreter. Dispatch is a plain match over opcodes (the P10 ceiling pass owns dispatch optimization). Lua→Lua calls share one loop and never recurse the Rust stack; only native↔Lua boundaries do (e.g. pcall).

Varargs follow 5.5 semantics: a vararg call materializes a vararg table (fields 1..n plus “n”) kept in the function’s own stack slot; ... expands from it and ...name binds it. 5.1 LUAI_COMPAT_VARARG also materializes a local arg table (see proto.has_compat_vararg_arg).

Structs§

HookState
Per-thread debug hook state (PUC lua_State hook/hookmask/basehookcount/ hookcount). func is the Lua hook; the booleans are the PUC mask bits.
Vm
A Lua virtual machine: one OS thread’s worth of Lua state.

Enums§

Error
Combined error type returned by Vm::eval and friends — either the chunk failed to parse / compile, or it raised at runtime.
RustHookEvent
Classified debug event delivered to a RustDebugHook.
WarnState
PUC 5.4+ default warnf state. The base library’s warn function flips between Off and On via the @on / @off control messages; any other @<word> control is silently ignored, mirroring lauxlib.c::checkcontrol.

Constants§

HOOK_MASK_CALL
Mask flags for Vm::set_rust_debug_hook. OR these to subscribe to multiple event categories with a single hook installation.
HOOK_MASK_COUNT
Subscribe to instruction-count events.
HOOK_MASK_LINE
Subscribe to line-change events.
HOOK_MASK_RETURN
Subscribe to function-return events.

Type Aliases§

RustDebugHook
Rust-side debug hook callback (B11). Receives the Vm plus a classified event. The callback runs synchronously in the dispatcher; the hook flag (in_hook) is set for its duration so hook recursion is suppressed.