pub struct VmState {
pub chunk_index: usize,
pub ip: usize,
pub current_line: usize,
pub stack: Vec<StateValue>,
pub variables: Vec<NamedValue>,
pub console: Vec<String>,
pub leak_log: Vec<String>,
}Expand description
the playground’s step-through snapshot of the VM.
Vm::get_state builds one of these. it carries everything the
playground’s panels render after each instruction: the current chunk index
and instruction pointer (the bytecode panel’s highlight), the value stack
(the animated stack panel), the current frame’s in-scope variables (the
variables panel), the accumulated console output (the console panel), and
the resource-leak log.
a plain data struct – no behaviour. derives serde::Serialize so Phase
6’s WASM bridge serializes it for JavaScript without a conversion layer.
Fields§
§chunk_index: usizethe index into Program::chunks of the function currently running.
ip: usizethe instruction pointer: a byte offset into that chunk’s code.
current_line: usizethe 1-based source line of the instruction at ip, for the editor’s
current-line highlight. 0 means no line – a synthesized instruction
or an out-of-range ip; the playground highlights nothing then.
stack: Vec<StateValue>the value stack bottom-to-top, each slot rendered and type-tagged.
variables: Vec<NamedValue>the current frame’s in-scope local variables, name + typed value.
console: Vec<String>the accumulated print / println output, one entry per write.
leak_log: Vec<String>the resource-leak log: a file handle freed while still open.