23 lines
1.2 KiB
Markdown
23 lines
1.2 KiB
Markdown
# 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
|
||
|
||
1. **Every opcode has an explicit stack effect**: `pop_n → push_m` (in *slots*, not “values”).
|
||
2. **Frames are explicit**: params/locals/operand stack are separate or formally delimited.
|
||
3. **No implicit behavior**: if it isn’t encoded in bytecode or runtime state, it doesn’t exist.
|
||
4. **Deterministic traps** only (no UB): trap includes `trap_code`, `pc`, `opcode`, and (if present) `span`.
|
||
5. **Bytecode stability**: versioned format; opcodes are immutable once marked v0.
|
||
|
||
### Compiler/VM boundary invariants
|
||
|
||
1. **Types map to slot counts** deterministically (including flattened SAFE structs and multi-slot returns).
|
||
2. **Calling convention is frozen**: param order, return slots, caller/callee responsibilities.
|
||
3. **Imports are compile/link-time only**; VM runs a fully-linked program image. |