- plan/README.md: sequencing principles, milestones M1-M5, phase table with exit criteria and blocking questions, dependency graph, error-code -> phase coverage, cross-cutting tracks, task conventions - phase-0..phase-8 files: scope, invariants, task tables (P<N>-<k>) with dependencies, outputs and mechanical "done when" checks
2.0 KiB
2.0 KiB
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-9 | todo | Phase exit review | all | plan status | exit criterion passes |