This commit is contained in:
Nilton Constantino
2026-01-31 18:12:44 +00:00
parent 9d484a9636
commit 33908aa828
4 changed files with 283 additions and 84 deletions
-74
View File
@@ -1,77 +1,3 @@
## PR-07 — Calling convention v0: CALL / RET / multi-slot returns
**Why:** Without a correct call model, PBS isn’t executable.
### Scope
* Introduce `CALL <u16 func_id>`
* caller pushes args (slots)
* callee frame allocates locals
* Introduce `RET`
* callee must leave exactly `return_slots` on operand stack at `RET`
* VM pops frame and transfers return slots to caller
* Define return mechanics for `void` (`return_slots=0`)
### Deliverables
* `FunctionTable` indexing and bounds checks
* Deterministic traps:
* `TRAP_INVALID_FUNC`
* `TRAP_BAD_RET_SLOTS`
### Tests
* `fn add(a:int,b:int):int { return a+b; }`
* multi-slot return (e.g., `Pad` flattened)
* void call
### Acceptance
* Calls are stable and stack-clean.
---
## PR-08 — Host syscalls v0: stable ABI, multi-slot args/returns
**Why:** PBS relies on deterministic syscalls; ABI must be frozen and enforced.
### Scope
* Unify syscall invocation opcode:
* `SYSCALL <u16 id> <u8 arg_slots> <u8 ret_slots>`
* Runtime validates:
* pops `arg_slots`
* pushes `ret_slots`
* Implement/confirm:
* `GfxClear565 (0x1010)`
* `InputPadSnapshot (0x2010)`
* `InputTouchSnapshot (0x2011)`
### Deliverables
* A `SyscallRegistry` mapping id -> handler + signature
* Deterministic traps:
* `TRAP_INVALID_SYSCALL`
* `TRAP_SYSCALL_SIG_MISMATCH`
### Tests
* syscall isolated tests
* wrong signature traps
### Acceptance
* Syscalls are “industrial”: typed by signature, deterministic, no host surprises.
---
## PR-09 — Debug info v0: spans, symbols, and traceable traps
**Why:** Industrial debugging requires actionable failures.