Files
aji/docs/plan/phase-4-islands.md
T
dev 03dda1245a spec: single normative source, accept RFC 0004, freeze AIR format 0, fuel
Owner decisions after the Phase 0 review:

- precedence: docs/spec/ is the single normative source; RFCs are
  decision records whose accepted rules are integrated into the spec in
  the same change (AGENTS.md, docs/README.md, rfcs/README.md, DD-011)
- RFC 0004 Accepted (scope: AIR format 0, language 0.1)
- AIR format 0 frozen as the semantic baseline; spec 07 §8.7 defines the
  only permitted additive changes, everything else needs `air 1` (DD-012)
- Q-019 resolved: deterministic instruction fuel (spec 11 §7). Outcome
  `limit_exceeded` is a runner outcome, not a trap; `aji run --fuel N`,
  exit code 5; conformance runs always use fuel (default 1 000 000,
  `fuel:` header); fuel/schedule budget/quantum kept separate for P3
  (DD-013)
2026-10-04 12:40:32 +03:00

37 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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 0001 island sections are proposed for acceptance (owner decision).
**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-1 | todo | Contract tables: `island.create`, `island.alloc`, `island.freeze`, `iref` access, `arc.clone`, `arc.release` | — | spec 07 appendix | all spec 07 §4 fields present |
| P4-2 | todo | Island allocator in the interpreter (private regions, O(1) transfer) | P4-1 | `src/interp/memory.zig` | transfer cost independent of graph size (unit benchmark with fixed bound) |
| P4-3 | todo | `iref` verifier and closure checks | P4-1 | `src/verifier/island.zig` | E2110, E2111 accept/reject |
| P4-4 | todo | Island transfer through channels and task spawn; sender invalidation | P4-3 | verifier + interpreter | sender use after send rejected (E2001) |
| P4-5 | todo | Freeze and `Frozen<T>`; Share/Send derivation | P4-3 | verifier + interpreter | concurrent reads of frozen graph accepted; mutable access rejected |
| P4-6 | todo | `Arc<T>` for `Share` values | P4-5 | verifier + interpreter | `Arc` of non-`Share` rejected (E4002); count changes visible in trace |
| P4-7 | todo | Reference program: island-pipeline | P4-4, P4-5 | `tests/programs/island-pipeline/` | passes under all P3 stress modes |
| P4-8 | todo | Phase exit review | all | plan status, RFC 0001 | exit criterion passes; RFC 0001 island sections ready for the owner |
## Conformance tests to add
Negative corpus entry owned by this phase: island internal reference escape. Plus E2111, freeze-then-mutate, `Arc` of non-`Share`.