Phase 4 exit review; AIR twins for the .aji-only island rejects
New AIR rejects: island_use_after_send (E2001), island_lend_task (E4002), island_destroy_while_borrowed (E2101), arc_content_mutex (E2111), frozen_borrow_mut (E1001). Every Phase 4 invariant now has an AIR and an .aji test. Full suite 392/392, also under --stress 1000 and --collect-every-step; test-extended, hosted smoke, source coverage 61/61.
This commit is contained in:
1 parent
3c5c129078
commit
7cc23338e2
7 files changed
+189
-2
No files matched your search
+2
-1
@@ -155,5 +155,6 @@ Targets for Phase 6A, measured on dev tasks:
|
||||
| P2 | done (exit review in the phase file) |
|
||||
| P3 | done (exit review in the phase file); P3-10, P3-11 moved to P7 |
|
||||
| P6A | done (exit review in `phase-6-source-language.md`; P6A-9 [results](../evaluation/results/2026-10-05-p6a-9.md)): the agent-facing source language over AIR is the architecture |
|
||||
| P4, P5 | unpaused after P6A (owner decision, 2026-10-05) |
|
||||
| P4 | done (exit review in the phase file) |
|
||||
| P5 | unpaused after P6A (owner decision, 2026-10-05); starts after the owner decision on the P4 exit review |
|
||||
| P7, P8 | not started |
|
||||
@@ -36,8 +36,46 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
| 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 |
|
||||
| P4-10 | done | 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`.
|
||||
|
||||
All four are present in AIR and `.aji`: `island_destroy_while_borrowed.air` / `destroy_while_borrowed.aji` (internal reference escape, `E2101`), `island_content_owner.air` / `content_owner.aji` (`E2111`), `island_use_after_freeze.air` and `frozen_borrow_mut.air` / `frozen_mut.aji` (freeze-then-mutate), `arc_content_mutex.air` / `arc_mutex.aji` (`arc` of a non-`ArcSafe` value, `E2111`).
|
||||
|
||||
## Exit review
|
||||
|
||||
- Exit criterion met: `program_island_pipeline.air`, written by an independent author from the spec, moves a cyclic graph between tasks through channels and freezes it for concurrent readers. It runs with `schedules: 30`, under `--stress 1000` (the whole suite, 392 tests, without a failure) and with `--collect-every-step`. `source/programs/island_pipeline.aji` is `equivalent:` to it. Transfer moves the owner handle only: the unit test "moving an island costs the same for any graph size" checks this with an instruction count, not a timer.
|
||||
- Invariants, each with an AIR and a `.aji` test:
|
||||
|
||||
| Invariant | Rejected example | Code |
|
||||
|---|---|---|
|
||||
| an `iref<T>` is used only with its own graph's owner | `island_foreign_iref.air`, `foreign_iref.aji` (run, trap) | `T0010` |
|
||||
| no edges into foreign mutable memory | `island_content_owner.air`, `content_owner.aji` | `E2111` |
|
||||
| after transfer the sender holds nothing | `island_use_after_send.air`, `use_after_send.aji` | `E2001` |
|
||||
| a frozen graph yields no mutable reference | `frozen_borrow_mut.air`, `frozen_mut.aji` | `E1001` / `E7005` |
|
||||
| counts change only through `arc.clone` / `arc.release` | `arc_release_twice.air`; trace test "arc count trace" | `E2002` |
|
||||
| an island is not `Share` | `island_lend_task.air`, `lend_island.aji` | `E4002` |
|
||||
|
||||
- Decision record: RFC 0014 Accepted (revision 2, owner decisions D1–D10 plus `iref` equality) and integrated into spec 02 §6, 03 §12–§14 and §22–§24, 04 §13/§35/§38.1, 07a and 15 (layer 9). Features published: `islands` (depends on `heap`) and `arc` (depends on `islands`).
|
||||
- Vertical rule: every construct went through spec → AIR → verifier → interpreter → `.aji` → Quick Reference (§7 Graphs, excerpts checked against `quickref/graphs.aji`) → conformance. Source coverage: 61/61 constructs.
|
||||
- Conformance: 392 tests. Phase 4 adds 16 AIR tests (3 run, 13 reject) and 20 `.aji` tests (6 run, 12 reject, the Quick Reference excerpt and the reference program).
|
||||
- Grammar: `reference/air-text.ebnf` now covers the syntax of Phases 2–4 (P4-11). Every opcode in the conformance corpus and in the spec contract tables has a production.
|
||||
- Complexity budget (cl100k):
|
||||
|
||||
| Bundle | Before | After |
|
||||
|---|---|---|
|
||||
| AIR Agent Reference Bundle | 35 324 | 39 154 (+10.8 % over the phase: +7.0 % RFC 0014, +3.6 % the completed grammar) |
|
||||
| `QUICK.md` | 4.37k | 5.01k |
|
||||
| Source docs | 22.4k | 26.7k |
|
||||
|
||||
RFC 0014 estimates: AIR +3–4k (measured +2.5k for the semantics), Quick Reference +600–800 (measured +640), source docs +3–4k (measured +4.3k, slightly above). The extra +1.4k in the AIR bundle is the grammar the bundle had been missing since Phase 2, not new semantics.
|
||||
- Known limitations:
|
||||
- Graph contents are plain data and `iref` handles only: there are no owners, resources or endpoints inside a graph.
|
||||
- `arc` is built from frozen graphs only: there is no `arc<mutex<T>>` and no weak handles.
|
||||
- Island memory is reclaimed only by `island.destroy`, `frozen.release` or the last `arc.release`. There is no per-object free inside a live island.
|
||||
- The execution-heap collector is an interpreter mechanism, not language semantics.
|
||||
- Q-023 (array argument borrows in `.aji`) remains open and is unrelated to islands.
|
||||
- Not run in this phase: the M/C regression corpus. It is a regression check only and needs a frozen matrix outside this repository.
|
||||
- Next: per the owner's order, decide whether the language is stable enough to start Phase 5 (atomics and the memory model) or whether a specialized atomics/concurrency benchmark comes first.
|
||||
@@ -0,0 +1,20 @@
|
||||
; An arc holds only ArcSafe values: a mutex is Share but not ArcSafe (E2111).
|
||||
; expect: reject E2111
|
||||
; phase: 4
|
||||
; spec: docs/spec/03-memory-model.md
|
||||
module test.arc_content_mutex
|
||||
air 0
|
||||
lang 0.1
|
||||
features [arc, cancellation, capabilities, effects, heap, islands, ownership, resources, sync, tasks]
|
||||
|
||||
fn @main(%heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc]
|
||||
entry:
|
||||
%v = const.u64 1
|
||||
%m = mutex.make %v
|
||||
arc.new %m, %heap, ok -> @made, err -> @oom
|
||||
made(%a: arc<mutex<u64>>):
|
||||
arc.release %a
|
||||
ret %v
|
||||
oom(%e: alloc_error):
|
||||
trap
|
||||
@@ -0,0 +1,26 @@
|
||||
; A frozen graph never yields a mutable reference: frozen.borrow gives ref<T>, and a store through it is E1001.
|
||||
; expect: reject E1001
|
||||
; phase: 4
|
||||
; spec: docs/spec/03-memory-model.md
|
||||
module test.frozen_borrow_mut
|
||||
air 0
|
||||
lang 0.1
|
||||
features [capabilities, effects, heap, islands, ownership, resources]
|
||||
|
||||
fn @main(%heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc]
|
||||
entry:
|
||||
%v = const.u64 1
|
||||
island.create %v, %heap, ok -> @made, err -> @oom
|
||||
made(%i: island<u64>):
|
||||
%f = island.freeze %i
|
||||
%g = borrow.ref %f
|
||||
%r = frozen.root %g
|
||||
%p = frozen.borrow %g, %r
|
||||
store %p, %v
|
||||
borrow.end %p
|
||||
borrow.end %g
|
||||
frozen.release %f
|
||||
ret %v
|
||||
oom(%e: alloc_error):
|
||||
trap
|
||||
@@ -0,0 +1,25 @@
|
||||
; A borrow of an object inside an island cannot outlive the island: destroying it while the borrow is live is E2101.
|
||||
; expect: reject E2101
|
||||
; phase: 4
|
||||
; spec: docs/spec/03-memory-model.md
|
||||
module test.island_destroy_while_borrowed
|
||||
air 0
|
||||
lang 0.1
|
||||
features [capabilities, effects, heap, islands, ownership, resources]
|
||||
|
||||
fn @main(%heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc]
|
||||
entry:
|
||||
%v = const.u64 1
|
||||
island.create %v, %heap, ok -> @made, err -> @oom
|
||||
made(%i: island<u64>):
|
||||
%g = borrow.ref %i
|
||||
%r = island.root %g
|
||||
%p = island.borrow %g, %r
|
||||
island.destroy %i
|
||||
%x = load %p
|
||||
borrow.end %p
|
||||
borrow.end %g
|
||||
ret %x
|
||||
oom(%e: alloc_error):
|
||||
trap
|
||||
@@ -0,0 +1,34 @@
|
||||
; An island is not Share (its owner may mutate it): lending it to a task is E4002.
|
||||
; expect: reject E4002
|
||||
; phase: 4
|
||||
; spec: docs/spec/04-concurrency-and-atomics.md
|
||||
module test.island_lend_task
|
||||
air 0
|
||||
lang 0.1
|
||||
features [capabilities, effects, heap, islands, ownership, resources, tasks]
|
||||
|
||||
fn @read(%g: ref<island<u64>>) -> u64
|
||||
effects []
|
||||
entry:
|
||||
%r = island.root %g
|
||||
%p = island.borrow %g, %r
|
||||
%v = load %p
|
||||
borrow.end %p
|
||||
ret %v
|
||||
|
||||
fn @main(%heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc, task.spawn]
|
||||
entry:
|
||||
%v = const.u64 1
|
||||
island.create %v, %heap, ok -> @made, err -> @oom
|
||||
made(%i: island<u64>):
|
||||
%g = borrow.ref %i
|
||||
%sc = task.scope.begin
|
||||
%t = task.spawn %sc, @read(%g)
|
||||
%r = task.join %t
|
||||
task.scope.end %sc
|
||||
borrow.end %g
|
||||
island.destroy %i
|
||||
ret %r
|
||||
oom(%e: alloc_error):
|
||||
trap
|
||||
@@ -0,0 +1,43 @@
|
||||
; After an island is sent, the sender holds nothing that reaches it: a later use is E2001.
|
||||
; expect: reject E2001
|
||||
; phase: 4
|
||||
; spec: docs/spec/03-memory-model.md
|
||||
module test.island_use_after_send
|
||||
air 0
|
||||
lang 0.1
|
||||
features [cancellation, capabilities, channels, effects, heap, islands, ownership, resources, tasks]
|
||||
|
||||
fn @main(%heap: cap<mem.alloc>) -> u64
|
||||
effects [mem.alloc, task.wait]
|
||||
entry:
|
||||
%one = const.usize 1
|
||||
channel.make island<u64>, %one, %heap, ok -> @made, err -> @oom
|
||||
made(%tx: sender<island<u64>>, %rx: receiver<island<u64>>):
|
||||
%v = const.u64 1
|
||||
island.create %v, %heap, ok -> @built, err -> @oom2
|
||||
built(%i: island<u64>):
|
||||
%txb = borrow.mut %tx
|
||||
channel.send %txb, %i, ok -> @sent, closed -> @fail, cancelled -> @fail
|
||||
sent:
|
||||
borrow.end %txb
|
||||
%g = borrow.ref %i
|
||||
borrow.end %g
|
||||
channel.close_sender %tx
|
||||
%rxb = borrow.mut %rx
|
||||
channel.recv %rxb, ok -> @got, closed -> @none, cancelled -> @none
|
||||
got(%back: island<u64>):
|
||||
borrow.end %rxb
|
||||
island.destroy %back
|
||||
channel.close_receiver %rx, ok -> @done, pending -> @pending
|
||||
none:
|
||||
trap
|
||||
done:
|
||||
ret %v
|
||||
pending(%r: receiver<island<u64>>):
|
||||
trap
|
||||
fail(%x: island<u64>):
|
||||
trap
|
||||
oom(%e: alloc_error):
|
||||
trap
|
||||
oom2(%e2: alloc_error):
|
||||
trap
|
||||
Reference in new issue
Block a user