comptime VM: strict no-fallback mode — the interp-retirement enumeration gate (Phase 4)

Add -Dcomptime-flat-strict / env SX_COMPTIME_FLAT_STRICT (implies comptime_flat):
at all three comptime sites (type-fn in lower/comptime.zig, const-init + #run in
emit_llvm.zig) a VM bail becomes a build-gating error naming the reason INSTEAD of
falling back to legacy. Forces every comptime eval onto the VM so the complete gap
set is enumerable in one sweep; when the corpus is green under strict mode AND every
example matches legacy, interp.zig can be deleted.

Default behaviour unchanged (699/0 both default gates). Fixed a wiring bug: the
type-fn site's local comptime_flat didn't include the strict flag (every type-fn
falsely reported <unknown>); strict now implies flat there too.

Swept the gap list (19 strict bails): switch_br (5, + unmasks a []Type-across-call
silent-wrong in 0114), compiler_call (6, = the BuildOptions->abi(.zig) extern
compiler migration), out (2), type_name (1), global_addr (1), interp_print_frames
(1), 2 negative-test diagnostics (1179/1180), 1 dlsym (1654). Recorded as the
deletion checklist in CHECKPOINT-COMPILER-API.md.
This commit is contained in:
agra
2026-06-18 19:06:51 +03:00
parent da6a8423c7
commit dcb1392255
4 changed files with 74 additions and 2 deletions

View File

@@ -244,8 +244,19 @@ pub fn build(b: *std.Build) void {
"comptime-flat",
"Default comptime evaluation to the flat-memory VM (legacy interp as fallback)",
) orelse false;
// `-Dcomptime-flat-strict` (or env `SX_COMPTIME_FLAT_STRICT`): run EVERY comptime
// eval on the VM with NO legacy fallback — a VM bail becomes a build-gating error
// naming the reason. The enumeration gate for retiring `interp.zig`: when the
// corpus is green under strict mode, the VM handles everything and legacy can be
// deleted. Implies `comptime_flat`.
const comptime_flat_strict = b.option(
bool,
"comptime-flat-strict",
"Run all comptime eval on the VM with NO fallback; a bail is a hard error (interp-retirement gate)",
) orelse false;
const build_opts = b.addOptions();
build_opts.addOption(bool, "comptime_flat", comptime_flat);
build_opts.addOption(bool, "comptime_flat_strict", comptime_flat_strict);
mod.addOptions("build_opts", build_opts);
const mod_tests = b.addTest(.{