- text AIR format 0: grammar (reference/air-text.ebnf) and module, block, SSA, type and canonical-form rules (spec 07 §8) - instruction contracts for format 0 (new spec 07a) - traps: stable T0xxx codes and trap records (spec 01 §6) - integer edge cases and explicit casts (spec 02 §2.1) - fixed verifier resource limits (spec 08 §7) - target description with pointer_bits (spec 09 §9) - new codes E0001-E0006, E1003, T0001-T0007 - resolves Q-001, Q-003..Q-008, Q-018; Q-002 resolved for format 0
3.2 KiB
08. Verifier
1. Role
The verifier is part of Aji's language semantics, not an optional lint pass.
A safe module that fails verification is not an executable Aji program.
2. Required passes
A conforming verifier performs, directly or equivalently:
- type verification;
- SSA/control-flow verification;
- initialization verification;
- ownership verification;
- borrow/alias verification;
- region lifetime and generation verification;
- island closure verification;
- linear-resource verification;
- effect verification;
- capability verification;
Send/Shareverification;- task-scope verification;
- synchronization and atomic-ordering validation;
- range/bounds verification;
- unsafe-boundary verification.
3. Per-value abstract state
The verifier may track:
type
initialization state
ownership state
borrow state
provenance
region and generation
bounds
alignment
integer range
Send/Share/Local properties
task scope
resource state
4. Ownership state machine
Representative states:
AVAILABLE
MOVED
BORROWED_SHARED(n)
BORROWED_MUT
CONSUMED
Transitions are instruction-defined.
A moved or consumed value cannot be reused unless a later operation returns a distinct new value.
5. Path sensitivity
The verifier propagates facts through branches.
Example:
if i < len(data) {
let x = data[i];
}
Inside the branch, i < len(data) is available as a proof fact.
6. Guards
guard condition records a verifier-recognized condition on the continuing path.
It may justify elimination of later runtime checks.
7. Bounded analysis
Verifier algorithms must have deterministic resource budgets.
If verification exceeds the spec-defined complexity bounds, the verifier emits a stable failure (E5101) rather than silently weakening checks.
Bounds are fixed by this specification, not configurable: a configurable bound would let a flag change which programs are accepted. Format version 0 defines:
| Limit | Value |
|---|---|
| functions per module | 65 536 |
| type declarations per module | 65 536 |
| fields per struct, variants per enum, payload values per variant | 256 |
| parameters per function or block, arguments per call or branch | 64 |
| blocks per function | 16 384 |
| instructions per function | 262 144 |
cases per switch |
4 096 |
The E5101 diagnostic carries the fields limit (name of the limit), max and found.
8. Contracts
Contracts may be classified as:
PROVEN_STATICALLY
CHECKED_AT_RUNTIME
ASSUMED_UNSAFE
UNPROVEN
A high-assurance profile may reject UNPROVEN or ASSUMED_UNSAFE results.
9. Concurrency verification
The verifier must reject:
- task lifetime escape;
- transfer of non-
Sendvalues to migratable tasks/threads; - concurrent mutable aliases not proven disjoint;
- sharing non-
Sharevalues through concurrent immutable access; - use of moved channel messages;
- accessing async I/O buffers while an outstanding operation owns/borrows them;
- illegal atomic memory orders.
10. Diagnostics
Every normative verifier rejection has a stable machine-readable code.
Diagnostics should include enough structured state for an agent to repair the program without parsing prose.