prometeu-runtime/docs/specs/pbs/files/PRs para Junie Global.md
Nilton Constantino dd61314bf9
pr 42
2026-01-31 15:15:42 +00:00

1.2 KiB
Raw Blame History

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 isnt encoded in bytecode or runtime state, it doesnt 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.