prometeu-studio/docs/pbs/agendas/12.4. IR and Lowering Workshop 4 - Builtins, Host Bindings, and Artifact Invariants.md
2026-03-24 13:42:18 +00:00

112 lines
3.7 KiB
Markdown

# PBS IR and Lowering Workshop 4
Status: Active
## Purpose
Run the fourth focused discussion for `12. IR and Lowering Specification.md` on the backend-facing edges:
- builtin projections,
- builtin constants,
- intrinsic member calls,
- host-binding emission,
- and artifact invariants required before verifier or loader stages.
## Why This Slice Last
This slice should come last because it depends on the general lowering contract plus the special ownership rules around VM-owned versus host-backed behavior.
## Proposed Meeting Order
1. Reconfirm already-settled builtin and host-binding facts.
2. Close lowering obligations for builtin projections and constants.
3. Close lowering obligations for intrinsic member calls.
4. Close host-binding emission obligations.
5. Close pre-verifier and pre-loader artifact invariants.
## Decisions To Produce
1. Builtin lowering obligations beyond already-settled metadata consumption.
2. Host-binding emission obligations before loader resolution.
3. The artifact invariants required before verifier/loader stages.
4. The exact boundary between `12`, `15`, and `19`.
## Candidate Decisions
### 1. Builtin Projections Stay VM-Owned Through Lowering
Candidate direction:
- builtin projection access lowers through VM-owned operations only,
- and never through host-binding tables or host syscall paths.
Rationale:
- This is already settled; `12` needs only to make the preserved obligation explicit.
### 2. Builtin Constants Lower Through Materialization, Not Constant Folding Semantics
Candidate direction:
- builtin constants lower through their VM-owned materialization path,
- not through ordinary user-authored compile-time constant evaluation.
Rationale:
- This keeps builtin shells distinct from ordinary `declare const`.
### 3. Host-Binding Emission Must Be Explicit Before `15`
Candidate direction:
- lowering must produce canonical host-binding entries,
- deduplicate them by canonical identity,
- and emit host-backed callsites in the pre-load form already fixed elsewhere.
Rationale:
- This is the bridge between bound source and artifact mapping.
### 4. `12` Defines Artifact Invariants, `15` Defines Encoding
Candidate direction:
- `12` states what must be true of the emitted artifact boundary,
- `15` states exactly how those facts appear in PBX and bytecode form,
- `19` states what must be verified.
Rationale:
- This keeps the three backend-facing specs from overlapping.
## Questions To Resolve In The Room
1. Does `12` need any abstract instruction vocabulary for builtins and host calls?
2. Which invariants belong to lowering rather than to verification?
3. How much ordering and dedup detail should `12` restate versus reference from other specs?
4. Should intrinsic lowering be specified as abstract op families or only semantic obligations?
5. What exact artifact guarantees must `13` eventually assert?
## Expected Outputs
1. a decision record for builtin lowering obligations,
2. a decision record for host-binding emission obligations,
3. and an artifact-invariants checklist spanning `12`, `15`, and `19`.
## Explicit Deferrals
- exact bytecode instruction encodings,
- exact PBX section layout,
- and verifier algorithm details.
## Inputs
- `docs/pbs/specs/6.1. Intrinsics and Builtin Types Specification.md`
- `docs/pbs/specs/6.2. Host ABI Binding and Loader Resolution Specification.md`
- `docs/pbs/specs/12. IR and Lowering Specification.md`
- `docs/pbs/specs/15. Bytecode and PBX Mapping Specification.md`
- `docs/pbs/specs/19. Verification and Safety Checks Specification.md`
- `docs/pbs/agendas/12. IR and Lowering Agenda.md`
- `docs/pbs/agendas/12.3. IR and Lowering Workshop 3 - Callables, Services, Contracts, and Callbacks.md`