pr 43
This commit is contained in:
@@ -1,45 +1,3 @@
|
||||
## PR-03 — Frame model v0: locals, operand stack, and function metadata
|
||||
|
||||
**Why:** `let x: int = 1` failing usually means locals/frames are not modeled correctly.
|
||||
|
||||
### Scope
|
||||
|
||||
* Define `FunctionMeta`:
|
||||
|
||||
* `code_offset`, `code_len`
|
||||
* `param_slots`, `local_slots`, `return_slots`
|
||||
* `max_stack_slots` (computed by verifier or compiler)
|
||||
* Define `Frame`:
|
||||
|
||||
* `base` (stack base index)
|
||||
* `locals_base` (or equivalent)
|
||||
* `return_slots`
|
||||
* `pc_return`
|
||||
* Decide representation:
|
||||
|
||||
* Option A (recommended v0): **single VM stack** with fixed layout per frame:
|
||||
|
||||
* `[args][locals][operand_stack...]`
|
||||
* Use `base + local_index` addressing.
|
||||
|
||||
### Deliverables
|
||||
|
||||
* `CallStack` with `Vec<Frame>`
|
||||
* `enter_frame(meta)` allocates locals area (zero-init)
|
||||
* `leave_frame()` reclaims to previous base
|
||||
|
||||
### Tests
|
||||
|
||||
* locals are isolated per call
|
||||
* locals are zero-initialized
|
||||
* stack is restored exactly after return
|
||||
|
||||
### Acceptance
|
||||
|
||||
* Locals are deterministic and independent from operand stack usage.
|
||||
|
||||
---
|
||||
|
||||
## PR-04 — Locals opcodes: GET_LOCAL / SET_LOCAL / INIT_LOCAL
|
||||
|
||||
**Why:** PBS `let` and parameters need first-class support.
|
||||
|
||||
Reference in New Issue
Block a user