1.2 KiB
1.2 KiB
VM PR Plan — PBS v0 Executable (Industrial Baseline)
Goal: make all PBS v0 functionality executable on the VM with deterministic semantics, closed stack/locals contract, stable ABI, and integration-grade tests.
Non-goal: new language features. If something must be reworked to achieve industrial quality, it must be reworked.
Guiding invariants (apply to every PR)
VM invariants
- Every opcode has an explicit stack effect:
pop_n → push_m(in slots, not “values”). - Frames are explicit: params/locals/operand stack are separate or formally delimited.
- No implicit behavior: if it isn’t encoded in bytecode or runtime state, it doesn’t exist.
- Deterministic traps only (no UB): trap includes
trap_code,pc,opcode, and (if present)span. - Bytecode stability: versioned format; opcodes are immutable once marked v0.
Compiler/VM boundary invariants
- Types map to slot counts deterministically (including flattened SAFE structs and multi-slot returns).
- Calling convention is frozen: param order, return slots, caller/callee responsibilities.
- Imports are compile/link-time only; VM runs a fully-linked program image.