Files
aji/docs/plan/phase-7-native-backend.md
T
dev 929132c81d Phase 3: owner decisions on RFC 0012 implementation
- spec 04 §40: mutex<T> always linear, never copyable; mutex.take is the
  only way to dismantle it and needs no live borrow (hence no guard and
  no waiter); no unlock or destructor
- P3-10 (async buffer claims, E4303) moved to P7-10 with task-aware
  I/O; E4303 stays reserved; Phase 3 scope closed
- RFC 0012 erratum: consumption after send is E2002, use is E2001
- tests: take while borrowed (E2101), use after take (E3001)
2026-10-04 16:57:59 +03:00

2.3 KiB
Raw Blame History

Phase 7 — Native backend

Non-normative. Part of the implementation plan.

Goal: verified AIR compiled to native code through LLVM, with a native runtime whose behavior matches the interpreter.

Exit criterion: interpreted and native executions pass the same conformance corpus on Linux x86_64, Linux aarch64 and macOS aarch64.

Spec inputs: spec 00 §6, 07 §6–7, 09.

Rule: native code is produced only from verified safe AIR (spec 07 §7). Optimizations may remove checks only when their failure is provably impossible (spec 00 §6).

Tasks

ID Status Task Depends Output Done when
P7-1 todo Decide LLVM integration (emit textual .ll and invoke an external clang/llc, or link the LLVM C API); record as DD — design/decisions.md decision recorded with TCB and reproducibility rationale
P7-2 todo Freeze opcode numbering for 0.1; binary AIR format — spec 07 §6, src/air/binary.zig binary ↔ text round-trip; version and feature bits encoded (spec 00 §5)
P7-3 todo AIR → LLVM lowering for P0–P2 features P7-1 src/backend/llvm/ P0–P2 corpus passes natively on Linux x86_64
P7-4 todo Native runtime: allocator adapters, regions, islands, traps, capability materialization, I/O P7-3 src/runtime/native/ runtime is listed in the unsafe report; no hidden allocation
P7-5 todo Native scheduler, synchronization primitives, atomics lowering P7-4 backend + runtime P3–P5 corpus and litmus pass natively
P7-6 todo FFI (extern "C"), @repr(C), @align, packed fields P7-3 backend E6101 accept/reject; ABI tests against C
P7-7 todo Targets: Linux aarch64, macOS aarch64 P7-5 CI matrix corpus passes on all three targets
P7-8 todo Parity runner: interpreter vs native on the full corpus P7-5 zig build parity identical stdout and trap records
P7-10 todo Task-aware I/O (io.read_start, io.write_start, io.wait) and async buffer claims: buffer state available → IN_FLIGHT → available; access while IN_FLIGHT is E4303 (moved from P3-10; needs an RFC) P7-5 RFC, verifier + runtime E4303 accept/reject; deterministic completion order
P7-9 todo Phase exit review all plan status exit criterion passes