ori run / ori test Backend Integration
Goal
Integrate the VM through the existing production backend boundary and CLI while preserving the pure architecture seams, one realization path, deterministic cache semantics, absolute evaluator/VM/LLVM/AOT behavior parity, and test isolation.
Implementation Sketch
- Preserve the compiled boundary from
plans/backend-boundary:CodegenBackendChoice { Llvm, Native }remains build/codegen-only. AddExecutionBackend { Vm, Compiled(CodegenBackendChoice) }forori run/ori test, flattened to the existing user-facing--backend=vm|llvm|nativevalues. Do not make the VM implementCodegenBackendand do not create another identically namedBackendChoice. - The CLI performs frontend analysis and shared executable-program realization once, then calls
VmBackend. A thin adapter may route typed inputs/results only; it cannot initiate ARC/impl/derive discovery, reach backward into the compiler database, perform hidden I/O, or own VM semantics. - Keep const evaluation on
ori_eval. Treat WASM as a compiledTargetSpecaccepted only by a compiled backend;plans/native-backendowns direct module emission and its runtime/host adapter. Make the command/mode/backend/target matrix explicit and reject unsupported combinations with actionable diagnostics. - Start with a session-local chunk cache keyed by stable function identity plus
realization/version provenance. Add Salsa persistence only after neutral
ReprEvidence, the selected physical plan, and every transitive input have deterministic equality, hashing, encoding version, and invalidation tests. - Add
ori test --backend=vmsequentially first. Enable parallel execution only after proving per-test VM stacks, runtime state, panic state, output capture, and leak accounting are isolated; include a race/stress regression. - Production VM selection is fail-closed: it either executes wholly in VM or returns a typed diagnostic. It never silently falls back to the evaluator or a compiled backend; const evaluation and compiled WASM are separate explicit routes.
- Keep
--dualan explicit diagnostic mode that runs the evaluator from the same frontend snapshot and VM/native backends from the same executable-program identity. Require absolute behavior parity under the frozen normalizer;--dualis never implicit production fallback.
Layer Coverage
| Layer | Disposition |
|---|---|
| L1 | N/A: backend selection adds no grammar. |
| L2 | N/A: backend selection changes no typechecking semantics. |
| L3 | N/A: backend selection changes no canonicalization semantics. |
| L4 | N/A: this section consumes the shared post-AIMS artifact without changing ARC. |
| L5 | Covered by the production VM run/test criterion. |
| L6 | Covered by the LLVM-debug selector regression criterion. |
| L7 | Covered by the LLVM-release selector regression criterion. |
| L8 | Covered by the AOT selector regression criterion. |
| L9 | Covered by the section cross-executor criterion. |
| L10 | Covered by the section leak-freedom criterion. |
| L11 | Covered by the VM spec-corpus criterion. |
| L12 | Covered by real ori run and ori test CLI criteria. |
Work Items
- Add
ExecutionBackend::Vmaround the existing compiled-backend selector and production--backend=vmrouting over one shared realization; use a versioned session cache first, keep const evaluation onori_eval, and route WASM only through direct compiled target selection. - Add sequential then isolation-proven parallel
ori test --backend=vm, diagnostic--dual, selector precedence/error tests, zero-fallback routing assertions, absolute parity, and real spec-corpus CLI coverage.