P5.7 Step A: VM is the sole comptime evaluator at emit-time + type-fn sites (no fallback)
Remove the comptime_flat/need_vm gate and the vm_result-orelse-legacy fallback from emit_llvm.zig (runComptimeSideEffects + emitGlobals const-init) and comptime.zig (runComptimeTypeFunc). The comptime VM now always runs; a bail is always a build-gating diagnostic, never a fallback. Delete the now-moot entryNeedsVm. runComptimeSideEffects drops the Interpreter entirely (VM writes #run output direct to fd 1); emitGlobals keeps a fresh interp_inst only as the valueToLLVMConst materialization context (the regToValue bridge, removed with interp.zig in a later step). #insert (evalComptimeString) still routes through the legacy interp — deferred until interp.zig deletion. Reconcile 1654: the comptime asm-global #run now reports the VM's clean dlsym bail instead of the legacy CannotEvalComptime wrapper (exit still 1). 501/501 unit + 706/0 corpus.
This commit is contained in:
@@ -431,6 +431,38 @@ when reached (sentinels or accessor fns; see the design doc Risks).
|
||||
`List` growth; orthogonal, see `current/CHECKPOINT-METATYPE.md`.)
|
||||
|
||||
## Log
|
||||
- **P5.7 Step A — the flip: VM is the SOLE comptime evaluator at the emit-time + type-fn sites; NO fallback
|
||||
(2026-06-19).** Removed the `if (self.comptime_flat or need_vm)` gate + the `vm_result orelse fallback`
|
||||
legacy-interp blocks from `emit_llvm.zig` (`runComptimeSideEffects` AND the const-init path in `emitGlobals`)
|
||||
and from `comptime.zig` `runComptimeTypeFunc` (type-fn). The VM now ALWAYS runs; a bail is ALWAYS a
|
||||
build-gating diagnostic (`comptime_vm.last_bail_reason`), never a fallback. Deleted `emit_llvm.entryNeedsVm`
|
||||
(moot — every entry runs on the VM now). `runComptimeSideEffects` no longer creates an `Interpreter` at all
|
||||
(VM writes `#run` `print` output direct to fd 1 via host-FFI); `emitGlobals` keeps a fresh `interp_inst` ONLY
|
||||
as the helper context `valueToLLVMConst` uses to materialize the VM's result Value (it evaluates nothing) —
|
||||
that's the `regToValue` bridge, removed in Step C with `interp.zig`. **`#insert` (`evalComptimeString`) still
|
||||
uses the legacy interp** — intentionally deferred to Step C (interp.zig still exists); it only needs the
|
||||
evaluator to bail without crashing (0737's real error is a lowering-time visibility diagnostic). The
|
||||
`comptime_flat*` LLVMEmitter fields are now set-but-unused (harmless; cosmetic cleanup later). **Snapshot
|
||||
reconcile:** only `1654` churned — the asm-global `#run` now reports the VM's clean `comptime init of
|
||||
'COMPUTED' failed: comptime extern call: symbol not found via dlsym …` instead of the legacy
|
||||
`CannotEvalComptime (op=call: …)` wrapper (exit still 1); regenerated scoped via `-Dname`. `1179`/`1180`
|
||||
unchanged (the VM-strict `comptime type construction failed:` wording already matched). **501/501 unit +
|
||||
706/0 corpus** (one gate now — `-Dcomptime-flat` is moot but still accepted). NEXT: Step B — delete the
|
||||
`#compiler` attribute (parse+lower) + the `compiler_call` IR op + `compiler_hooks.zig`.
|
||||
- **P5.7 Step 0 — strict sweep CLEAN; zero VM gaps to port (2026-06-19).** Gating prerequisite for deleting the
|
||||
legacy fallback. Confirmed both gates 706/0 + 501/501 unit (gate-OFF and `-Dcomptime-flat`). Then ran every
|
||||
corpus example (706) under `SX_COMPTIME_FLAT_STRICT=1` (VM, NO fallback) via `.sx-tmp/strict_sweep.sh` —
|
||||
`sx run` (JIT), `sx build` (aot/bundle), or `sx ir --target` (cross-arch). Only **3** examples emit a VM-bail
|
||||
signature, ALL expected-failures (strict exit == expected exit), NONE a real gap: **1179**
|
||||
(`enum has no variants`) + **1180** (`duplicate variant name`) render the SAME `comptime type construction
|
||||
failed:` diagnostic the VM-strict path in `comptime.zig` already emits (no snapshot churn at the flip); **1654**
|
||||
(asm-global called at `#run`) — the VM bails cleanly via `callHostExtern` dlsym ("symbol not found … target-
|
||||
specific binding called at compile time?"), only its `.stderr` WORDING changes (legacy `CannotEvalComptime
|
||||
(op=call…)` → VM strict form) and must be reconciled at the flip. **Key conclusion (the prompt's flagged risk):
|
||||
no SUCCESSFUL corpus example relies on the legacy VM→legacy fallback** — every passing example runs natively on
|
||||
the VM; the only fallback users are the 3 expected-failures above. Removing the fallback is therefore safe. No
|
||||
ops to port before flipping. NEXT: make `-Dcomptime-flat` permanent + delete the fallback (emit_llvm both sites
|
||||
+ comptime.zig) + remove `entryNeedsVm`, reconcile 1654.
|
||||
- **P5.8 (partial) — real-project validation: m3te + distribution build with the new pipeline (2026-06-19).**
|
||||
Acceptance test for the sx-driven build pipeline. **m3te** (`~/projects/m3te`, an SDL3 match-3 game): migrated
|
||||
its `build.sx` off the deleted API — `configure_build :: ()` → `() abi(.compiler)`, `opts.set_post_link_callback(
|
||||
|
||||
Reference in New Issue
Block a user