Types cap<K>, resources, own/region, scope/task/shield, endpoints, mutex/guard, island/frozen/iref/arc and the built-in enums; productions for capability, heap, region, task, cancellation, channel, sync and graph instructions, with the named-edge terminator forms. Every opcode in the conformance corpus and in the spec contract tables has a production. AIR bundle +3.6 % (cl100k), recorded.
44 lines
4.2 KiB
Markdown
44 lines
4.2 KiB
Markdown
# Phase 4 — Islands
|
||
|
||
Non-normative. Part of the [implementation plan](README.md).
|
||
|
||
**Goal:** uniquely owned closed mutable graphs that move between tasks in O(1), and irreversible freezing into shareable immutable graphs.
|
||
|
||
**Exit criterion:** a cyclic graph moves between tasks with no deep copy and no shared mutation (`island-pipeline` reference program).
|
||
|
||
**Spec inputs:** spec 03 §12–15, 04 §13; [RFC 0014](../rfcs/0014-islands-frozen-arc.md) (Accepted, revision 2; integrated into spec 02 §6, 03 §12–§14 and §22–§24, 04 §13/§35/§38.1, 07a, 15 §8) makes RFC 0001's island sections concrete.
|
||
|
||
**Vertical rule (owner decision after P6A-9):** every feature goes through spec → AIR → verifier → interpreter → `.aji` lowering → Quick Reference → conformance (AIR and `.aji`) in this phase; nothing is left for a later frontend phase.
|
||
|
||
**Blocking questions:** none recorded; log new ones before starting.
|
||
|
||
## Invariants
|
||
|
||
- `iref<T>` points only inside its own island and is never dereferenced without access to the owning island;
|
||
- an island has no edges into foreign mutable memory;
|
||
- after transfer the sender holds nothing that reaches the island;
|
||
- a `Frozen<T>` never yields a mutable reference in safe code;
|
||
- reference counts change only through explicit `arc.clone` / `arc.release`.
|
||
|
||
## Tasks
|
||
|
||
| ID | Status | Task | Depends | Output | Done when |
|
||
|---|---|---|---|---|---|
|
||
| P4-0 | done | RFC 0014: decisions D1–D10, owner review | — | `docs/rfcs/0014-islands-frozen-arc.md` | Accepted (revision 2) |
|
||
| P4-1 | done | Spec integration: spec 03 §12–14, 04 §13/§35/§38.1, 07a contract tables, 15 (layer 9), error codes (`T0010`) | P4-0 | spec, reference | contract tables complete (spec 07 §4 fields) |
|
||
| P4-1a | done | Publish `islands` (depends on `heap`) and add `arc` (depends on `islands`) | P4-1 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
|
||
| P4-2 | done | Interpreter: island tables, identities never reused, `T0010`, freeze, O(1) transfer; arc counts in the trace; collector support | P4-1 | `src/interp/` | transfer cost independent of graph size (unit test with an instruction-count bound); `--collect-every-step` passes |
|
||
| P4-3 | done | Verifier: types and classes, storability (`E2111`), container child borrows, arc rules (`E4002`/`E1001`), Send/Share rows | P4-1 | `src/verifier/` | accept/reject per rule |
|
||
| P4-4 | done | Transfer through channels and spawn; sender invalidation | P4-3 | verifier + interpreter | use after send rejected (`E2001`); schedule stress |
|
||
| P4-5 | done | Freeze and `frozen<T>`; lending to tasks | P4-3 | verifier + interpreter | concurrent reads accepted; mutable access rejected |
|
||
| P4-6 | done | `arc<T>`: `arc.from_frozen`, `arc.new` (`ArcSafe`), `clone`, `release`, `root`, `borrow` | P4-5 | verifier + interpreter | non-`ArcSafe` rejected (`E2111`); count changes visible in the trace |
|
||
| P4-7 | done | `.aji` layer 9: types, operations, `island.at`/`frozen.at`/`arc.at` places, explicit container borrows; Quick Reference section; source coverage rows | P4-3 | `src/frontend/`, `docs/agent/` | `.aji` run/reject tests; Quick Reference examples checked; `tools/source_coverage.py` passes |
|
||
| P4-8 | done | Reference program `island-pipeline` in AIR and `.aji` with equivalence | P4-4, P4-5, P4-6, P4-7 | `tests/conformance/` | passes under all P3 stress modes |
|
||
| P4-9 | done | Complexity budget: AIR bundle, Quick Reference, Source Reference Bundle measured against the RFC estimate | P4-7 | `docs/agent/README.md` | growth recorded and justified |
|
||
| P4-11 | done | `reference/air-text.ebnf` covers the syntax of Phases 2–4: `cap<K>`, endpoint, task, graph and built-in types; `own.*`, `task.*`, `channel.*` (with the type operand of `channel.make`), `island.*`/`frozen.*`/`arc.*`/`iref.eq`; the multi-edge terminator forms (found by the independent author of `program_island_pipeline.air`) | — | `docs/reference/air-text.ebnf` | every instruction of spec 07a and spec 03 §22–§24 has a production |
|
||
| P4-10 | todo | Phase exit review | all | plan status | exit criterion passes |
|
||
|
||
## Conformance tests to add
|
||
|
||
Negative corpus entry owned by this phase: island internal reference escape. Plus E2111, freeze-then-mutate, `Arc` of non-`Share`.
|