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.
91 lines
1.7 KiB
Markdown
91 lines
1.7 KiB
Markdown
# RFC 0004: AIR Instruction Set
|
|
|
|
Status: Proposed
|
|
Target: Aji 0.1
|
|
|
|
## Goal
|
|
|
|
AIR should be small enough for complete semantic definitions to fit in an agent context while remaining expressive enough for systems software.
|
|
|
|
## Principle
|
|
|
|
Do not add instructions because they make source syntax convenient. Add an AIR instruction only when it represents a distinct semantic/verifier operation.
|
|
|
|
## Initial instruction families
|
|
|
|
### Pure values
|
|
|
|
```text
|
|
const copy move
|
|
integer arithmetic
|
|
bitwise operations
|
|
comparisons
|
|
casts with explicit failure/semantics
|
|
```
|
|
|
|
### Control
|
|
|
|
```text
|
|
br cbr switch ret trap guard assert
|
|
```
|
|
|
|
### Memory
|
|
|
|
```text
|
|
borrow.ref borrow.mut borrow.end
|
|
load store
|
|
slice.make slice.sub
|
|
mem.copy mem.zero
|
|
```
|
|
|
|
### Ownership
|
|
|
|
```text
|
|
own.alloc own.free
|
|
region.create region.alloc region.reset region.destroy
|
|
island.create island.alloc island.freeze
|
|
arc.clone arc.release
|
|
```
|
|
|
|
### Resources and calls
|
|
|
|
```text
|
|
call call.indirect intrinsic.call
|
|
resource.consume
|
|
```
|
|
|
|
### Concurrency
|
|
|
|
```text
|
|
task.scope.begin task.scope.end
|
|
task.spawn task.join task.cancel
|
|
thread.spawn thread.join
|
|
channel.send channel.recv
|
|
mutex.lock mutex.unlock
|
|
rwlock.read rwlock.write
|
|
atomic.load atomic.store atomic.rmw atomic.cmpxchg atomic.fence
|
|
```
|
|
|
|
## Required metadata
|
|
|
|
Each opcode definition must declare:
|
|
|
|
```text
|
|
syntax
|
|
operand types
|
|
result types
|
|
ownership transfer
|
|
borrow transfer
|
|
memory read/write set
|
|
sync relation
|
|
required effect
|
|
required capability
|
|
trap cases
|
|
verifier transfer function
|
|
interpreter behavior
|
|
```
|
|
|
|
## Binary stability
|
|
|
|
AIR opcodes should receive stable numeric IDs only after the semantics of v0.1 freeze. Before then, text AIR is the safer canonical interchange for development.
|