Dynamic data-race detector for ordinary memory: vector clocks are the
task-keyed part of the weak-memory views, so happens-before follows every
synchronization edge already modelled; per-cell shadows with path
granularity. Enabled for every conformance run test (433, no false
positive); a unit test shows an unverified racy program caught on every
schedule. Reference program atomic_stats in .aji and hand-written AIR by an
independent author (equivalent:, 30 schedule seeds). Author feedback:
07a clarifications; Q-025 (no array construction) logged.
A. Interpreter memory grew with the number of executed steps (one arena,
never reclaimed): block and call arguments, frames, frame storage, value
copies, place paths, channel buffers and per-step scratch now live in a
collectable execution heap. Between instructions, past a threshold, the
live state is copied into a fresh heap (sharing preserved) and the old one
released. Long-lived state (module, world, authority, task, channel and
region tables, the result) stays in the caller's arena. The guarded value
of a mutex is a separate cell (no interior pointers). Nothing observable
changes: fuel, schedule, PRNG, values, traps and run records are the same.
- test: five loop shapes x 100k/1M/4M iterations, measured with the
interpreter's own heap counters: live state after a collection does not
grow with the iteration count; the heap stays under a fixed bound
- conformance --collect-every-step: the second run of every run test
collects before every instruction; records must be byte-identical
(passes, also with --stress 20)
B. A void function whose body ends in an if/if-else/match/block/void call
lowered to `ret %` (malformed AIR, reported as E0001): it now lowers to
`ret`. Seven fall-through tests (six failed before).
Also: files_opened counts reads by relative path and file name; P6A-11
(malformed generated AIR as an internal compiler diagnostic) and Q-023
(ref of a whole array as an argument) recorded.
- intrinsics from the registry as plain calls: fallible ones are outcome
matches or `or trap` (E7006 otherwise), infallible ones plain calls
- resource operands by name, borrowed mut for the one operation and ended
on every edge; a mut binding/parameter passes as is; `mut f` is E7006
- closes consume with `move` (E7003); no inserted closes (E3002/E3001)
- data operands explicit (ref/mut/byte string, E7005 otherwise)
- file<…>, stream, listener types; cap.narrow.prefix with cap_error edges
- ref/mut unchecked s[i] (also as a binding) and assume(c) under
effects [unsafe]; boundary left to the verifier (E6001)
- trusted is reserved and rejected (E7006)
- parameter names preserved; generated names avoid them (normative)
- parser: >> closes two type arguments
- conformance: `equivalent:` compares the run record with a reference
AIR program (hello, file_copy, tcp_echo, narrow ok/not_subset/invalid,
random)
- spec 15, grammar, quick reference (io_error match fixed), plan, examples
src/frontend: lexer, AST, parser for the full 6A grammar (first error
only: one E7001 with span, expected and found), lowering to canonical
text AIR with a line map. Variables become SSA with block parameters
carried across if/while/for/loop joins; short-circuit and/or; checked,
wrapping and cast forms; calls; untyped let literals typed from later
uses, never guessed (E7007). The frontend repairs nothing.
check.checkFile: .aji → frontend → existing AIR parser and verifier;
every diagnostic at its source location, AIR location kept as
air_line/air_col; trap records gain source_location. CLI: check/run on
.aji, aji lower [--annotate].
Runner: .aji tests with the same headers; every accepted module must
lower deterministically, be canonical (lower → parse → print
unchanged) and match <file>.expected if present. Layer-1 tests: 6 run,
6 E7xxx rejects, 2 verifier-caught (E1002, E3101).
- program_parallel_map: four exclusive loans of disjoint quarters
- program_channel_transfer: heap-owned messages moved through a bounded
channel; the 64-byte budget fits exactly the bounded worst case
- program_tcp_echo_tasks: server task, one echo task per connection,
two client tasks sharing address and message by shared loans
- runner --stress N: seeds 0..N-1 under quanta 1, 2, 7 and the test's
own; failures print the replay command; CI runs --stress 200
- plan: P3-12, P3-13 done
- interpreter core rewritten around explicit per-task frame stacks so a
task can be suspended at any instruction; behavior of all existing
tests unchanged
- tasks: scope and task<T> (function-bound; task_transfer and
task_borrow_returns reserved), spawn/join/cancel/cancelled/scope.end;
cooperative scheduler with seeded choice rule, separate schedule seed,
quantum = fuel unit, task limit (limit_exceeded kind tasks), global
quiescence over waiting tasks; schedule field in the run record
- verifier: Send/Share table (E4001, E4002), loans as task-owned borrows
(E4302 on early end, E4101 on conflicts), E4301 at scope end, task
effects (E3101)
- CLI --quantum, --task-limit, --schedule-seed; runner schedules:,
quantum:, task_limit:, limit_exceeded:
- fixed: schedule seed default used orelse/^ precedence wrongly
- 15 phase-3 conformance tests; 4000 mutants without a crash
- Agent Reference Bundle +10.9 % tokens (recorded)
- air: cap<K> and built-in enums (cap_error) as types; enum.switch over
built-in enums; cap.narrow terminator with ok/err targets; intrinsic
syntax (registry still empty: E0004); registries for effects,
capability kinds and built-in enums, synced with reference docs
- verifier: effect stage (E3101, flat, direct callees); cap.narrow form
check (E3202) and ok/err parameter rules (E5002, E1001); capabilities
are copyable, not zeroable, not comparable; sizes cap 8, built-in tag
- interp: host authority table; @main instantiation from grants by
parameter name with not_instantiated reasons; capabilities render as
opaque
- CLI: --grant P=KIND[:SCOPE], exit code 6; runner: grant: and
not_instantiated: headers, pending only for unsupported features
- conformance: 18 Phase 2 tests; 4000 mutants without a crash
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)
- src/interp/machine.zig: format-0 interpreter on the air64 target;
checked/wrapping arithmetic, shifts, casts, aggregates, calls with a
1024-frame limit, traps as records with T0xxx codes
- aji run: prints one JSON run record; exit code 4 on trap
- conformance runner: `expect: run` with `result:`/`trap:`, every run
executed twice and compared byte-for-byte; header keys must be single
lowercase words
- Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
Draft specification, RFCs, reference registries and examples, plus the
reference-implementation skeleton: build.zig, diagnostic envelope with
error-code registry synced to docs, aji CLI, conformance runner with seed
tests, CI and contributor docs.