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.
64 lines
1.3 KiB
Markdown
64 lines
1.3 KiB
Markdown
# 11. Determinism, Trace and Replay
|
|
|
|
## 1. Interpreter
|
|
|
|
The reference AIR interpreter defines executable semantic behavior for the language model.
|
|
|
|
## 2. Trace
|
|
|
|
Trace mode may record each AIR instruction and selected abstract-state changes.
|
|
|
|
Example:
|
|
|
|
```text
|
|
#120 region.create -> r3
|
|
#121 region.alloc r3 4096 -> p8
|
|
#122 borrow.mut p8 -> b4
|
|
#123 store.u32 b4 10
|
|
#124 borrow.end b4
|
|
```
|
|
|
|
## 3. Deterministic mode
|
|
|
|
Deterministic execution controls or records sources of nondeterminism including:
|
|
|
|
- task scheduling choices;
|
|
- timer progression;
|
|
- clock reads;
|
|
- random inputs;
|
|
- I/O completion ordering;
|
|
- channel wake selection;
|
|
- selected filesystem/network inputs.
|
|
|
|
## 4. Replay
|
|
|
|
A recorded execution should be replayable when program, runtime and replay-format compatibility requirements are met.
|
|
|
|
```text
|
|
aji run --record failure.ajr app.aji
|
|
aji replay failure.ajr
|
|
```
|
|
|
|
## 5. Concurrency exploration
|
|
|
|
Test mode may systematically or pseudo-randomly vary scheduling at synchronization points.
|
|
|
|
Candidate scheduling points include:
|
|
|
|
- atomic operations;
|
|
- lock/unlock;
|
|
- channel send/receive;
|
|
- task yield/wake;
|
|
- I/O completion;
|
|
- cancellation observation.
|
|
|
|
Example:
|
|
|
|
```text
|
|
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.
|