Expand description
M5: bytecode VM. Stack machine with effect dispatch through a host handler.
Structs§
- Deny
AllEffects - A handler that fails any effect call. Useful as a default for pure-only runs.
- Null
Tracer - No-op tracer for normal execution.
- Vm
Enums§
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
Valueslots a frame may consume fromVm::stack_record_arenabefore furtherOp::AllocStackRecordrequests fall back to the heap path. 64 slots at the currentsize_of::<Value>() = 64Bgives ~4 KiB per frame, matching the design-doc proposal indocs/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§
- Effect
Handler - Host-side effect dispatch. Implementors decide what
kind/opmean and how arguments map to side effects. - Tracer
- Trace receiver. Implementors record the call/effect tree and may substitute effect responses (for replay).