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.
1.7 KiB
1.7 KiB
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
const copy move
integer arithmetic
bitwise operations
comparisons
casts with explicit failure/semantics
Control
br cbr switch ret trap guard assert
Memory
borrow.ref borrow.mut borrow.end
load store
slice.make slice.sub
mem.copy mem.zero
Ownership
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
call call.indirect intrinsic.call
resource.consume
Concurrency
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:
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.