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)
This commit is contained in:
1 parent
dc36b5cfc0
commit
03dda1245a
24 files changed
+268
-63
No files matched your search
+8
-7
@@ -5,7 +5,7 @@
|
||||
| Directory | Kind | Purpose |
|
||||
|---|---|---|
|
||||
| [`spec/`](spec/) | **Normative** | What a conforming implementation MUST do |
|
||||
| [`rfcs/`](rfcs/) | Normative once Accepted | Major design proposals with rationale |
|
||||
| [`rfcs/`](rfcs/) | Decision records | Major design proposals and their rationale; accepted changes live in `spec/` |
|
||||
| [`reference/`](reference/) | Normative registries | Grammar, error codes, intrinsics, type properties, litmus tests, glossary |
|
||||
| [`design/`](design/) | Non-normative | Short design decisions and the open-questions log |
|
||||
| [`plan/`](plan/) | Non-normative | Implementation plan, per-phase task breakdowns, conformance plan |
|
||||
@@ -13,13 +13,14 @@
|
||||
|
||||
## Precedence
|
||||
|
||||
When documents disagree (from `AGENTS.md`):
|
||||
The specification is the single normative source. When documents disagree (from `AGENTS.md`):
|
||||
|
||||
1. accepted RFCs;
|
||||
2. `spec/`;
|
||||
3. `reference/`;
|
||||
4. examples;
|
||||
5. README prose.
|
||||
1. `spec/`;
|
||||
2. `reference/`;
|
||||
3. examples;
|
||||
4. README prose.
|
||||
|
||||
RFCs are not in this list: accepting an RFC integrates its rules into `spec/` in the same change, after which the RFC is the record of *why*, and the spec is the record of *what*.
|
||||
|
||||
`design/`, `plan/` and `dev/` never override the above. If a plan or dev document contradicts the spec, the plan or dev document is wrong.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Reason: Zig's standard library changes between minor versions; an unpinned toolc
|
||||
|
||||
## DD-009 — CLI diagnostics are JSON Lines on stdout
|
||||
|
||||
`aji` writes one JSON diagnostic per line on stdout, human notes on stderr, and uses fixed exit codes (0 accepted or returned, 1 rejected, 2 usage/I/O, 3 not yet implemented, 4 trapped).
|
||||
`aji` writes one JSON diagnostic per line on stdout, human notes on stderr, and uses fixed exit codes (0 accepted or returned, 1 rejected, 2 usage/I/O, 3 not yet implemented, 4 trapped, 5 execution limit exceeded).
|
||||
|
||||
Reason: agents consume diagnostics programmatically (spec 10); mixing prose into the machine channel breaks repair loops.
|
||||
|
||||
@@ -57,3 +57,21 @@ Reason: agents consume diagnostics programmatically (spec 10); mixing prose into
|
||||
Tests live in `tests/conformance/phase<N>/{accept,reject}/` with `expect`/`phase`/`spec` header lines that the runner strips before parsing.
|
||||
|
||||
Reason: AIR is the conformance format (spec 07 §1), and keeping metadata out of the AIR grammar lets the grammar evolve independently of the test harness.
|
||||
|
||||
## DD-011 — The specification is the single normative source
|
||||
|
||||
RFCs are decision records. Accepting an RFC integrates its rules into `docs/spec/` in the same change; afterwards the spec is authoritative and the RFC keeps the rationale.
|
||||
|
||||
Reason: a permanent "accepted RFC overrides spec" rule makes old RFCs conflict with the current spec over time; one normative source keeps agents from having to reconcile layers.
|
||||
|
||||
## DD-012 — AIR format 0 is a frozen semantic baseline
|
||||
|
||||
After Phase 0, the meaning of existing format-0 constructs does not change. Later phases may only add instructions, types, features and codes under the rules of spec 07 §8.7; anything else needs `air 1` and an RFC.
|
||||
|
||||
Reason: a stable foundation lets generated code, tests and tools rely on format 0 indefinitely.
|
||||
|
||||
## DD-013 — Deterministic fuel instead of timeouts
|
||||
|
||||
Runs are bounded by fuel (executed AIR instructions), never by wall-clock time. Exhaustion is the outcome `limit_exceeded` (exit code 5), not a trap.
|
||||
|
||||
Reason: timeouts make test outcomes depend on machine speed; a trap code for exhaustion would make the test harness part of the language semantics.
|
||||
@@ -24,7 +24,7 @@ Status values: `open`, `resolved`.
|
||||
| Q-016 | open | P0 | Floating-point determinism |
|
||||
| Q-017 | open | P5 | Replay file format |
|
||||
| Q-018 | resolved | P2 | Runtime diagnostics (traps) vs verifier diagnostics |
|
||||
| Q-019 | open | P3 | Non-terminating programs in test tooling |
|
||||
| Q-019 | resolved | P3 | Non-terminating programs in test tooling |
|
||||
|
||||
## Q-001 — Text AIR grammar
|
||||
|
||||
@@ -123,3 +123,5 @@ The error registry covers verifier/compiler errors. Traps and runtime check fail
|
||||
## Q-019 — Non-terminating programs in test tooling
|
||||
|
||||
A program may legitimately loop forever, so the language cannot bound execution. The conformance runner and `ajid` still need a way to stop a run without making the outcome depend on wall-clock time. Options: a deterministic step budget that is a tooling parameter (reported as "budget exhausted", never as a language trap), or explicit `fuel:` in test headers. Must be decided before scheduler stress tests (P3), which multiply run counts.
|
||||
|
||||
**Resolved:** deterministic instruction fuel (spec 11 §7). Wall-clock time is never used to determine semantic test termination. Fuel exhaustion is an execution-runner outcome (`limit_exceeded`, CLI exit code 5), not an Aji trap.
|
||||
+4
-1
@@ -32,11 +32,14 @@ Planned header extensions (added by the phase that needs them):
|
||||
|---|---|---|
|
||||
| `expect: run` + `result:` / `trap:` | P0 (implemented) | module must verify; run record must match |
|
||||
| `stdout:` | P2 | expected output, `\n`-escaped (needs `io.write`) |
|
||||
| `seed:` / `schedules:` | P3 | deterministic scheduler seed / number of randomized schedules |
|
||||
| `fuel:` | P0 (implemented) | instruction limit; default 1 000 000 (spec 11 §7.1) |
|
||||
| `seed:` / `schedules:` / `quantum:` | P3 | scheduler seed / schedule budget / instructions per forced scheduling point (spec 11 §7.2) |
|
||||
| `profile:` | P2 | runtime profile (`hosted`, `deterministic`, …) |
|
||||
|
||||
## Determinism checks
|
||||
|
||||
No test outcome may depend on wall-clock time. Runs are bounded by fuel; fuzz and stress tooling must always pass a fuel limit.
|
||||
|
||||
Every run test is executed twice by the runner from P0-12 onward and the outputs (stdout, trap record, trace hash) compared byte-for-byte. Concurrency tests additionally run under the stress modes listed in `plan/conformance-suite.md`.
|
||||
|
||||
## Diagnostics as API
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ These run through all phases rather than belonging to one.
|
||||
|
||||
| Track | Rule |
|
||||
|---|---|
|
||||
| Spec | Each phase's first tasks update `../spec/` and the open-questions log. RFCs 0001–0004 move to Accepted in the phase that implements them (P1, P3, P5, P0 respectively). |
|
||||
| Spec | Each phase's first tasks update `../spec/` and the open-questions log. RFCs are proposed for acceptance in the phase that implements them (0001 in P1, 0002 in P3, 0003 in P5; 0004 was accepted after P0); acceptance integrates their rules into the spec in the same change. New constructs extend format 0 only under spec 07 §8.7. |
|
||||
| Diagnostics | New codes are added to `../reference/error-codes.md` and `src/diag.zig` together; structured fields per code are documented in the spec section that defines the rule. |
|
||||
| Determinism | Every run test is executed twice and compared from P0-12 on; concurrency tests add schedule stress from P3. |
|
||||
| Audit reports | Each phase that adds an auditable fact (unsafe sites, effects, capabilities, weak atomics, eliminated checks) extends the report in `src/report/` (spec 10 §6, spec 13 §5). |
|
||||
@@ -93,6 +93,6 @@ These run through all phases rather than belonging to one.
|
||||
|
||||
| Phase | Status |
|
||||
|---|---|
|
||||
| P0 | done (exit review in the phase file) |
|
||||
| P0 | done; AIR format 0 frozen as the semantic baseline (spec 07 §8.7) |
|
||||
| P1 | next |
|
||||
| P2–P8 | not started |
|
||||
@@ -6,7 +6,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
**Exit criterion:** AIR `hello` and arithmetic tests execute identically across runs. Per Q-008, Phase 0 `hello` is a `@main` returning a value; output to stdout arrives in P2-11.
|
||||
|
||||
**Spec inputs:** spec 00 §5–6, 01 §6, 02 §1–3, 07, 08 §1–2, §7, 10 §2, 11 §1. RFC 0004 moves to Accepted at the end of this phase.
|
||||
**Spec inputs:** spec 00 §5–6, 01 §6, 02 §1–3, 07, 08 §1–2, §7, 10 §2, 11 §1. RFC 0004 was accepted for AIR format 0 after the exit review.
|
||||
|
||||
**Blocking questions:** Q-001 grammar, Q-002 contracts, Q-003 parse codes, Q-004 traps, Q-005 budget, Q-006 target description, Q-007 integer edge cases, Q-008 `hello`, Q-016 floats.
|
||||
|
||||
@@ -32,7 +32,7 @@ Out: floats (reserved until Q-016 is answered), fixed arrays (moved to P1 with s
|
||||
| P0-10 | done | Deterministic verifier budget | P0-7 | `src/verifier/budget.zig` | E5101 test with an oversized module; budget value matches spec |
|
||||
| P0-11 | done | Interpreter core | P0-8, P0-9 | `src/interp/machine.zig` | arithmetic programs run; overflow, assert and explicit `trap` produce the trap records defined in P0-2 |
|
||||
| P0-12 | done | `aji run`; `expect: run` / `stdout:` / `trap:` in the conformance runner; double-run determinism check | P0-11 | `src/main.zig`, `tools/conformance.zig` | runner fails a test whose two runs differ |
|
||||
| P0-13 | done | Phase exit review | all | plan status, RFC 0004 status | `hello` and arithmetic suite pass; RFC 0004 amended for format 0 (acceptance is an owner decision); P0 status set to done |
|
||||
| P0-13 | done | Phase exit review | all | plan status, RFC 0004 status | `hello` and arithmetic suite pass; RFC 0004 Accepted for format 0; P0 status set to done |
|
||||
|
||||
## Conformance tests to add
|
||||
|
||||
@@ -45,6 +45,7 @@ Out: floats (reserved until Q-016 is answered), fixed arrays (moved to P1 with s
|
||||
- Exit criterion met: `zig build conformance` runs 41 Phase 0 tests (3 accept, 19 reject, 15 run); every run test is executed twice and the run records compared byte-for-byte.
|
||||
- Every code introduced in Phase 0 has a reject test: E0001–E0006, E1001–E1003, E5001, E5002, E5101; traps T0001–T0007 each have a run test.
|
||||
- Parser and verifier survived 6 000 mutated corpus inputs through `aji check` and `aji run` without a crash (one crash found and fixed).
|
||||
- RFC 0004 received Amendment 1 describing the format-0 additions; its status stays Proposed until the language owner accepts it.
|
||||
- RFC 0004 with Amendment 1 was accepted by the language owner (scope: AIR format 0, language 0.1). Its rules live in spec 07 §8, spec 07a and `reference/air-text.ebnf`.
|
||||
- **Format 0 is the frozen semantic baseline** (spec 07 §8.7, DD-012). Phases 1–3 may add instructions, types, features and codes; changing the meaning of an existing format-0 construct requires `air 1` and an RFC.
|
||||
- Deferred: interpreter memory grows with the number of calls and aggregates created, because everything lives in one arena per run. Acceptable for conformance tests; revisit with the Phase 1 memory model.
|
||||
- New open question Q-019 (non-terminating programs in test tooling).
|
||||
- Q-019 resolved after the review: deterministic instruction fuel (spec 11 §7), outcome `limit_exceeded`, exit code 5; the conformance runner always runs with fuel.
|
||||
@@ -6,7 +6,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
**Exit criterion:** the file-copy core (buffer handling, regions, slices) is implemented in AIR, and the verifier rejects representative use-after-move, aliasing and out-of-bounds cases.
|
||||
|
||||
**Spec inputs:** spec 02 §4–5, 03 §1–11, 08 §3–6, 13 §2. RFC 0001 moves to Accepted (island sections may stay Proposed until P4).
|
||||
**Spec inputs:** spec 02 §4–5, 03 §1–11, 08 §3–6, 13 §2. RFC 0001 memory sections are proposed for acceptance (owner decision; island sections may wait until P4); acceptance integrates them into the spec.
|
||||
|
||||
**Blocking questions:** Q-009 borrow lifetimes in AIR, Q-010 region generation checks.
|
||||
|
||||
@@ -20,7 +20,7 @@ Out: islands, `Arc`, `Pin`, raw addresses (beyond rejecting them in safe code).
|
||||
|
||||
| ID | Status | Task | Depends | Output | Done when |
|
||||
|---|---|---|---|---|---|
|
||||
| P1-1 | todo | Resolve Q-009 and Q-010; review RFC 0001 memory sections to Accepted | — | spec 03, 07, RFC 0001 | questions resolved; RFC status updated |
|
||||
| P1-1 | todo | Resolve Q-009 and Q-010; propose RFC 0001 memory sections for acceptance | — | spec 03, 07, RFC 0001 | questions resolved; RFC ready for the owner, rules integrated on acceptance |
|
||||
| P1-2 | todo | Contract tables for Phase 1 opcodes | P1-1 | spec 07 appendix | every in-scope opcode has all spec 07 §4 fields, including verifier transfer function |
|
||||
| P1-3 | todo | Interpreter memory: allocations, provenance, bounds, region generations, uninitialized bytes | P1-2 | `src/interp/memory.zig` | unit tests: every access checks provenance; reading uninitialized bytes is detected in interpreter debug checks |
|
||||
| P1-4 | todo | Initialization verifier | P1-2 | `src/verifier/init.zig` | E1010 accept/reject (scalar, struct field, array prefix) |
|
||||
|
||||
@@ -6,9 +6,9 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
**Exit criterion:** `parallel_map` and `channel_transfer` examples run under deterministic and randomized schedules.
|
||||
|
||||
**Spec inputs:** spec 04 §1–19, 11 §3, §5–6. RFC 0002 moves to Accepted.
|
||||
**Spec inputs:** spec 04 §1–19, 11 §3, §5–6. RFC 0002 is proposed for acceptance (owner decision); acceptance integrates it into the spec.
|
||||
|
||||
**Blocking questions:** Q-013 deterministic `select` and seeds, Q-014 Send/Share for capability-holding aggregates.
|
||||
**Blocking questions:** Q-013 deterministic `select` and seeds, Q-014 Send/Share for capability-holding aggregates. (Q-019 is resolved: fuel, schedule budget and quantum are defined in spec 11 §7.)
|
||||
|
||||
## Invariants (AGENTS.md change checklist applies to every task here)
|
||||
|
||||
@@ -22,9 +22,9 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
| ID | Status | Task | Depends | Output | Done when |
|
||||
|---|---|---|---|---|---|
|
||||
| P3-1 | todo | Resolve Q-013, Q-014; RFC 0002 to Accepted | — | spec 04, 11 | questions resolved |
|
||||
| P3-1 | todo | Resolve Q-013, Q-014; propose RFC 0002 for acceptance | — | spec 04, 11 | questions resolved |
|
||||
| P3-2 | todo | Contract tables: `task.*`, `thread.*`, `channel.*`, `mutex.*`, `rwlock.*`, select | P3-1 | spec 07 appendix | all spec 07 §4 fields including synchronization effects |
|
||||
| P3-3 | todo | Deterministic scheduler: seeds, choice points, choice log | P3-2 | `src/interp/sched.zig` | same seed ⇒ identical trace; choice log replays a run |
|
||||
| P3-3 | todo | Deterministic scheduler: seeds, choice points, choice log; global fuel across tasks and a separate `quantum` (spec 11 §7.2) | P3-2 | `src/interp/sched.zig` | same seed ⇒ identical trace; choice log replays a run; fuel is the sum over all tasks |
|
||||
| P3-4 | todo | Send/Share/Local derivation | P3-1 | `src/verifier/send_share.zig` | E4001, E4002 accept/reject |
|
||||
| P3-5 | todo | Task-scope verifier and scoped borrows | P3-2 | `src/verifier/tasks.zig` | E4301, E4302 accept/reject |
|
||||
| P3-6 | todo | Concurrent alias / data-race rejection | P3-5 | `src/verifier/borrow.zig` | E4101 accept/reject; disjoint `split_mut` halves accepted in two tasks |
|
||||
@@ -33,7 +33,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
| P3-9 | todo | Mutex and RwLock with linear guards | P3-7 | interpreter + verifier | guard not `Send`; unlock consumes guard; E3002 on leaked guard |
|
||||
| P3-10 | todo | Async I/O buffer claims | P3-7 | verifier + runtime | E4303 accept/reject |
|
||||
| P3-11 | todo | Blocking effect and blocking pool policy | P3-7 | spec 04 §18, runtime | `thread.block` from ordinary task handled per spec |
|
||||
| P3-12 | todo | Runner: `seed:`/`schedules:` headers; stress modes (1/2/N workers, random, forced yield, slow consumer, cancellation during waits, I/O reordering) | P3-3 | `tools/conformance.zig` | stress modes selectable; failing seed printed for replay |
|
||||
| P3-12 | todo | Runner: `seed:`/`schedules:`/`quantum:` headers (schedule budget kept separate from fuel); stress modes (1/2/N workers, random, forced yield, slow consumer, cancellation during waits, I/O reordering) | P3-3 | `tools/conformance.zig` | stress modes selectable; failing seed printed for replay |
|
||||
| P3-13 | todo | Reference programs: parallel-map, channel transfer, tcp-echo with tasks | P3-8, P3-9 | `tests/programs/` | pass under all stress modes |
|
||||
| P3-14 | todo | Phase exit review | all | plan status | exit criterion passes |
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
**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 move to Accepted.
|
||||
**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.
|
||||
|
||||
@@ -29,7 +29,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
| 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 fully Accepted |
|
||||
| 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
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
**Exit criterion:** the litmus suite (`reference/concurrency-litmus.md`) and atomic-publication conformance tests pass, including allowed weak outcomes.
|
||||
|
||||
**Spec inputs:** spec 04 §20–32, 11; `reference/concurrency-litmus.md`. RFC 0003 moves to Accepted.
|
||||
**Spec inputs:** spec 04 §20–32, 11; `reference/concurrency-litmus.md`. RFC 0003 is proposed for acceptance (owner decision); acceptance integrates it into the spec.
|
||||
|
||||
**Blocking questions:** Q-015 operational weak-memory model, Q-017 replay format.
|
||||
|
||||
@@ -21,7 +21,7 @@ Non-normative. Part of the [implementation plan](README.md).
|
||||
|
||||
| ID | Status | Task | Depends | Output | Done when |
|
||||
|---|---|---|---|---|---|
|
||||
| P5-1 | todo | Resolve Q-015, Q-017; RFC 0003 to Accepted | — | spec 04, 11 | questions resolved |
|
||||
| P5-1 | todo | Resolve Q-015, Q-017; propose RFC 0003 for acceptance | — | spec 04, 11 | questions resolved |
|
||||
| P5-2 | todo | Contract tables: `atomic.load`, `atomic.store`, `atomic.rmw`, `atomic.cmpxchg`, `atomic.fence` | P5-1 | spec 07 appendix | all fields present, including allowed orderings per op |
|
||||
| P5-3 | todo | Atomic types and ordering validation | P5-2 | `src/verifier/atomics.zig` | E4201 accept/reject for every op, including cmpxchg failure order |
|
||||
| P5-4 | todo | `atomic` / `atomic.weak` effect marking | P5-3 | verifier + report | relaxed use without `atomic.weak` rejected per Q-011 outcome; weak sites listed in report |
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# RFC NNNN: Title
|
||||
|
||||
Status: Draft
|
||||
Target: Aji 0.x
|
||||
Scope: —
|
||||
Language version: 0.x
|
||||
Supersedes: —
|
||||
|
||||
<!-- Status values: Draft → Proposed → Accepted → Implemented, or Rejected. See README.md. -->
|
||||
<!-- Status values and lifecycle: README.md. On acceptance, integrate the normative rules into docs/spec/ in the same change. -->
|
||||
|
||||
## Motivation
|
||||
|
||||
@@ -49,8 +50,14 @@ Expected diagnostic:
|
||||
|
||||
New or changed codes in `docs/reference/error-codes.md`.
|
||||
|
||||
## Spec integration
|
||||
|
||||
Files and sections of `docs/spec/` and `docs/reference/` that receive the normative rules on acceptance.
|
||||
|
||||
## Compatibility and migration
|
||||
|
||||
Which AIR format version is affected. A change to the meaning of an existing construct requires a new format version (spec 07 §8.7).
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
## Unresolved questions
|
||||
@@ -1,7 +1,9 @@
|
||||
# RFC 0004: AIR Instruction Set
|
||||
|
||||
Status: Proposed
|
||||
Target: Aji 0.1
|
||||
Status: Accepted
|
||||
Scope: AIR format 0
|
||||
Language version: 0.1
|
||||
Integrated into: spec 07 §8, spec 07a, `reference/air-text.ebnf`
|
||||
|
||||
## Goal
|
||||
|
||||
@@ -91,7 +93,7 @@ AIR opcodes should receive stable numeric IDs only after the semantics of v0.1 f
|
||||
|
||||
## Amendment 1 — format version 0 (Phase 0)
|
||||
|
||||
Status: Proposed, implemented in the reference implementation.
|
||||
Status: Accepted with the RFC; implemented in the reference implementation.
|
||||
|
||||
Format version 0 (spec 07 §8, spec 07a) realizes the "pure values" and "control" families and adds the following, each a distinct verifier operation rather than syntax sugar:
|
||||
|
||||
|
||||
+30
-5
@@ -1,23 +1,48 @@
|
||||
# RFC Process
|
||||
|
||||
RFC status values:
|
||||
RFCs are architectural decision records. They capture the motivation, alternatives and rationale for a major decision. They are **not** a normative layer: the specification under `docs/spec/` is the single normative source.
|
||||
|
||||
## Lifecycle
|
||||
|
||||
```text
|
||||
Draft → Proposed → Accepted → Implemented
|
||||
↘ Rejected
|
||||
↘ Rejected ↘ Superseded by RFC NNNN
|
||||
```
|
||||
|
||||
| Status | Meaning |
|
||||
|---|---|
|
||||
| Draft | being written; not ready for review |
|
||||
| Proposed | ready for the language owner's decision |
|
||||
| Accepted | approved; its normative rules are integrated into `docs/spec/` and `docs/reference/` **in the same change** that sets this status |
|
||||
| Implemented | the reference implementation and conformance tests cover it |
|
||||
| Rejected | not adopted; kept for the record |
|
||||
| Superseded | replaced by a later RFC; kept for the record |
|
||||
|
||||
Only the language owner moves an RFC to Accepted or Rejected.
|
||||
|
||||
After acceptance, an RFC is not edited to track later spec changes. If the spec and an accepted RFC disagree, the spec is authoritative and the RFC describes the decision as it was made.
|
||||
|
||||
## Header
|
||||
|
||||
```text
|
||||
Status: <status>
|
||||
Scope: <what the decision covers, e.g. AIR format 0>
|
||||
Language version: <e.g. 0.1>
|
||||
```
|
||||
|
||||
## Required content
|
||||
|
||||
An RFC that changes memory safety, concurrency, effects/capabilities, AIR or unsafe semantics must include:
|
||||
|
||||
- motivation;
|
||||
- precise invariant;
|
||||
- normative rule changes;
|
||||
- normative rule changes, with the spec files and sections they will be integrated into;
|
||||
- verifier implications;
|
||||
- interpreter/runtime implications;
|
||||
- valid example;
|
||||
- rejected example;
|
||||
- diagnostics impact;
|
||||
- migration/compatibility notes;
|
||||
- migration/compatibility notes, including the AIR format version affected (spec 07 §8.7);
|
||||
- alternatives considered.
|
||||
|
||||
Until an RFC is marked Accepted, the normative files under `docs/spec/` remain authoritative.
|
||||
Template: [`0000-template.md`](0000-template.md).
|
||||
+14
-1
@@ -212,7 +212,7 @@ An implementation MUST reject a module whose `air` format version or `lang` vers
|
||||
|
||||
- Integer types, `bool`, `void` and `never` are built in. `usize`/`isize` are distinct from all fixed-width types; their width comes from the target description (spec 09 §9).
|
||||
- `type @T = struct { … }` and `type @T = enum { … }` declare nominal aggregate types. An aggregate MUST NOT contain itself by value, directly or through other aggregates (`E1003`).
|
||||
- In format version 0 every value is copyable; ownership categories arrive with format version 1 (Phase 1).
|
||||
- Every type defined in this section is copyable. Types added later under §8.7 (for example `Own<T>` in Phase 1) may be move-only or linear; that does not change the types defined here.
|
||||
- `void` is only valid as a function return type. A `void` function returns with `ret` without operand; a call to it MUST NOT bind a result. A `never` function MUST NOT contain `ret`.
|
||||
|
||||
### 8.4 Reserved
|
||||
@@ -228,3 +228,16 @@ Serializing a parsed module and parsing the result MUST yield an equal module.
|
||||
### 8.6 Diagnostic order
|
||||
|
||||
Verification stops after the first stage that reports an error, in this order: parsing and name resolution, resource limits, CFG structure, SSA, types. Within a stage, diagnostics are ordered by source position. The result is therefore deterministic for a given input.
|
||||
|
||||
### 8.7 Stability of format 0
|
||||
|
||||
Format 0 is the frozen semantic baseline of AIR (RFC 0004, Accepted). Its existing constructs keep their meaning for as long as `air 0` exists.
|
||||
|
||||
A change is permitted under `air 0` only if all of the following hold:
|
||||
|
||||
1. every module accepted before the change is still accepted and produces the same run record (spec 07a "Run result") or the same trap record;
|
||||
2. every module rejected before the change is still rejected with the same codes, **except** where the rejection was `E0004` (unknown opcode or type name) or `E0006` (reserved type or unsupported feature) and the change gives that name a meaning;
|
||||
3. the change adds instructions, types, header features, diagnostic codes or trap codes, and specifies each new instruction in spec 07a before it is implemented;
|
||||
4. the canonical form (§8.5) of existing constructs is unchanged.
|
||||
|
||||
Any other change to format 0 — a different meaning, typing rule, trap behavior, diagnostic code or canonical spelling for an existing construct — requires a new format version (`air 1`) introduced by an RFC. An implementation that supports several format versions selects the semantics by the module's `air` line; it never mixes them.
|
||||
@@ -181,3 +181,5 @@ A terminator ends a block (spec 07 §8.2). Terminators bind no result.
|
||||
| enum | `{"variant":"Name","payload":[…]}` |
|
||||
|
||||
On a trap it reports `{"status":"trapped", "code":…, "kind":…, "function":…, "block":…, "inst":…}` (spec 01 §6).
|
||||
|
||||
When the runner stops execution because an execution limit is exhausted (spec 11 §7), it reports `{"status":"limit_exceeded","kind":"fuel","limit":N,"steps":N}`. This is an outcome of the execution environment, not of the program, and is not a trap.
|
||||
@@ -61,3 +61,41 @@ aji test --interleavings=10000
|
||||
## 6. Deterministic selection
|
||||
|
||||
When `select` has multiple ready branches, deterministic mode must choose according to a stable rule and record the decision.
|
||||
|
||||
## 7. Execution limits
|
||||
|
||||
Wall-clock time MUST NOT determine whether a run, test or verification terminates or what its outcome is.
|
||||
|
||||
### 7.1 Fuel
|
||||
|
||||
A runner MAY bound execution with **fuel**: the number of AIR instructions executed.
|
||||
|
||||
- Every instruction consumes one unit of fuel when it begins execution, including terminators, `assert` and `call`.
|
||||
- The instructions executed inside a callee consume fuel separately; a `call` costs one unit regardless of the callee.
|
||||
- If no fuel remains when an instruction is about to begin, execution stops before that instruction and the run ends with the outcome `limit_exceeded` (spec 07a "Run result"), reporting `limit` and `steps` (the number of instructions executed, equal to `limit`).
|
||||
|
||||
Fuel exhaustion is a decision of the execution environment, not behavior of the program:
|
||||
|
||||
- it is not a trap and has no `T` code;
|
||||
- a program's semantics are the same with or without a fuel limit, except that a limited run may end early with `limit_exceeded`;
|
||||
- for a given module, inputs and fuel limit, the outcome is deterministic.
|
||||
|
||||
The three run outcomes are therefore:
|
||||
|
||||
```text
|
||||
returned the program finished
|
||||
trapped the program failed (T0xxx)
|
||||
limit_exceeded the environment stopped the program
|
||||
```
|
||||
|
||||
Running without a fuel limit is permitted (for example `aji run program.air`). Conformance, fuzz and stress runs MUST use a fuel limit.
|
||||
|
||||
### 7.2 Concurrent execution (from Phase 3)
|
||||
|
||||
With several tasks, fuel is global: the sum of instructions executed by all tasks. Two further, separate budgets apply to scheduling and MUST NOT be conflated with fuel:
|
||||
|
||||
| Budget | Bounds |
|
||||
|---|---|
|
||||
| fuel | how long the program may execute |
|
||||
| schedule budget | how many interleavings schedule exploration examines |
|
||||
| quantum | how many instructions a task executes before a forced scheduling point |
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
# Aji Specification 0.1
|
||||
|
||||
Status: **Draft 0.1**. Normative unless an accepted RFC says otherwise (see precedence in [`../README.md`](../README.md)).
|
||||
Status: **Draft 0.1**. The specification is the single normative source (see precedence in [`../README.md`](../README.md)). RFCs record decisions and rationale; their accepted rules are integrated here.
|
||||
|
||||
The specification is split by semantic domain. Rationale for major decisions lives in [`../rfcs/`](../rfcs/); short decisions in [`../design/decisions.md`](../design/decisions.md).
|
||||
|
||||
@@ -59,5 +59,6 @@ ownership transfer
|
||||
## Changing the spec
|
||||
|
||||
- Small clarifications and gap fills: edit the file directly, in the same change as the tests that exercise them.
|
||||
- Changes to memory safety, concurrency, effects/capabilities, AIR or unsafe semantics: write an RFC first ([`../rfcs/0000-template.md`](../rfcs/0000-template.md)).
|
||||
- Changes to memory safety, concurrency, effects/capabilities, AIR or unsafe semantics: write an RFC first ([`../rfcs/0000-template.md`](../rfcs/0000-template.md)). On acceptance, integrate its rules into this directory in the same change.
|
||||
- AIR format 0 is frozen (spec 07 §8.7). Incompatible changes require a new format version.
|
||||
- Known gaps are tracked in [`../design/open-questions.md`](../design/open-questions.md). Close the entry when the spec answers it.
|
||||
Reference in new issue
Block a user