P5.7 Step C: delete interp.zig — the comptime VM is the sole evaluator

The legacy tagged-Value Interpreter is gone. Relocate the Value result-DTO
+ decodeVariantElements into a new comptime_value.zig (the VM<->host
materialization boundary); repoint comptime_vm/emit_llvm/ir-barrel Value to
it and BuildConfig to compiler_hooks; delete the dead valueToReg bridge;
slim compiler_lib.zig to just the name registry (BoundFn{sx_name} + bound_fns
+ findFn — weldedCompilerFn only validates names); simplify printInterpBailDiag
to comptime_vm.last_bail_reason; drop the unused interp_mod import in lower.zig.
rm src/ir/interp.zig + interp.test.zig.

Value is relocated (not eliminated): it survives only as the slim result DTO
at the VM->valueToLLVMConst boundary; the execution-time marshaling the VM
pivot targeted is gone. Drop dead Value.asString/reflectTypeId.

706/0 corpus + 476/476 unit.
This commit is contained in:
agra
2026-06-19 20:05:57 +03:00
parent 103a156b26
commit 7b8be86834
11 changed files with 217 additions and 3721 deletions

View File

@@ -431,6 +431,30 @@ when reached (sentinels or accessor fns; see the design doc Risks).
`List` growth; orthogonal, see `current/CHECKPOINT-METATYPE.md`.)
## Log
- **P5.7 Step C — DELETED `interp.zig` (the legacy tagged-`Value` interpreter); the VM is the SOLE comptime
evaluator (2026-06-19).** Five green commits. **C1** (`#insert` → VM): `evalComptimeString` was the last
caller of `Interpreter.call`; routed through `comptime_vm.tryEval` (the VM bails-not-panics on malformed
lowering-time IR like 0737's `ret Ref.none`; `regToValue` dupes the result string into the lowering allocator).
**C2a** (ops.zig inline comptime-call fold → VM): the `emitCall` zero-arg comptime-callee fold now uses
`tryEval`. **C2b** (emit_llvm): dropped the `*const Interpreter` materialization param from `valueToLLVMConst`/
`serializeAggregateValue` (it was used ONLY for the `.heap_ptr` data arm, which the VM's `regToValue` never
produces) + the dead `interp_inst`. **C3** (the atomic delete, done by a delegated worker + independently
verified): moved the `Value` result-DTO + `decodeVariantElements` into a new `src/ir/comptime_value.zig`
(the VM↔host materialization boundary type); repointed `comptime_vm`/`emit_llvm`/`ir.zig`-barrel `Value` to it
and `BuildConfig` to `compiler_hooks`; deleted the dead `valueToReg` bridge; slimmed `compiler_lib.zig` to just
the name registry (`BoundFn{sx_name}` + `bound_fns` + `findFn`, all names preserved — `weldedCompilerFn` only
validates names; deleted `FnHandler` + all `handle*` + the `Interpreter`/`Value`/`InterpError` imports);
simplified `main.printInterpBailDiag` to use only `comptime_vm.last_bail_reason`; dropped the unused
`interp_mod` import in `lower.zig`; **`rm src/ir/interp.zig` (2383 lines) + `src/ir/interp.test.zig` (844
lines)** + their barrel entries. **DEVIATION from the plan's literal "delete Value":** `Value` is RELOCATED
(not eliminated) as the slim result/materialization DTO — the byte-addressable VM executes natively, and
`Value` survives ONLY at the VM→`valueToLLVMConst` boundary (the marshaling the pivot killed was at EXECUTION
time, which is gone). Eliminating it entirely (materializing LLVM consts straight from VM `Machine` bytes) is a
larger, riskier rewrite deferred as optional follow-up; the plan's PRIMARY goal — ONE evaluator, no legacy
interpreter, no fallback — is fully met. **706/0 corpus + 476/476 unit** (24 from the deleted interp unit
tests + 1 `valueToReg` round-trip test). Also dropped dead `Value.asString`/`reflectTypeId` (no callers).
NEXT: Step D — re-express `define`/`make_enum` as sx over the compiler-API (they were legacy interp arms);
Step E — land the 0141 repro + finalize.
- **P5.7 Step B — deleted the `#compiler`/`compiler_call`/hook-Registry mechanism end-to-end (2026-06-19).**
All superseded by `abi(.compiler)` VM-native dispatch (P5.5) — no sx code emits any of it. Two green commits:
**B1** (`e2971f2`) removed the `compiler_call` IR op: the op variant + `CompilerCall` struct (`inst.zig`), the