Skip to main content

Module vm

Module vm 

Source
Expand description

M5: bytecode VM. Stack machine with effect dispatch through a host handler.

Structs§

DenyAllEffects
A handler that fails any effect call. Useful as a default for pure-only runs.
NullTracer
No-op tracer for normal execution.
Vm

Enums§

VmError

Constants§

MAX_CALL_DEPTH
Maximum simultaneous call frames. Defends against unbounded recursion in agent-emitted code: a body that calls itself without a base case would otherwise blow the host’s native stack and crash the process. Real Lex code rarely exceeds ~30 frames; 1024 is generous headroom while still well under the OS stack limit at any per-frame size we use.
STACK_RECORD_BUDGET_SLOTS
Per-frame stack-record budget (#464 step 2). Counts the number of Value slots a frame may consume from Vm::stack_record_arena before further Op::AllocStackRecord requests fall back to the heap path. 64 slots at the current size_of::<Value>() = 64B gives ~4 KiB per frame, matching the design-doc proposal in docs/design/escape-analysis.md. A handler-shaped function (one outer record of ≤8 fields, plus a handful of small inner records) fits well inside this without growing.

Traits§

EffectHandler
Host-side effect dispatch. Implementors decide what kind/op mean and how arguments map to side effects.
Tracer
Trace receiver. Implementors record the call/effect tree and may substitute effect responses (for replay).

Functions§

dump_ic_stats