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

@@ -461,30 +461,13 @@ fn deriveOutputName(input_path: []const u8) []const u8 {
/// Format the "interpreter bailed during X" message, attaching the IR op
/// and the source location (line:col) when the interpreter captured them.
fn printInterpBailDiag(comp: *const sx.core.Compilation, label: []const u8, err: anyerror) void {
const op = sx.ir.Interpreter.last_bail_op orelse {
// The post-link build driver runs on the comptime VM (core.invokeByFuncId),
// so a bail there sets `comptime_vm.last_bail_reason`, not the legacy
// interp's statics. Surface that reason when present.
if (sx.ir.comptime_vm.last_bail_reason) |reason| {
std.debug.print("error: {s} failed: {s}: {s}\n", .{ label, @errorName(err), reason });
return;
}
std.debug.print("error: {s} failed: {s}\n", .{ label, @errorName(err) });
return;
};
const op_detail: []const u8 = if (sx.ir.Interpreter.last_bail_builtin) |b| b else op;
const explanation = sx.ir.Interpreter.last_bail_detail orelse "";
const sep: []const u8 = if (explanation.len > 0) ": " else "";
if (sx.ir.Interpreter.last_bail_file) |file| {
if (comp.import_sources.get(file)) |source| {
const loc = sx.errors.SourceLoc.compute(source, sx.ir.Interpreter.last_bail_offset);
std.debug.print("error: {s} failed: {s} (op={s}/{s}{s}{s}) at {s}:{d}:{d}\n", .{ label, @errorName(err), op, op_detail, sep, explanation, file, loc.line, loc.col });
return;
}
std.debug.print("error: {s} failed: {s} (op={s}/{s}{s}{s}) at {s}:+{d}\n", .{ label, @errorName(err), op, op_detail, sep, explanation, file, sx.ir.Interpreter.last_bail_offset });
_ = comp;
// The comptime VM is the sole evaluator; a bail sets comptime_vm.last_bail_reason.
if (sx.ir.comptime_vm.last_bail_reason) |reason| {
std.debug.print("error: {s} failed: {s}: {s}\n", .{ label, @errorName(err), reason });
return;
}
std.debug.print("error: {s} failed: {s} (op={s}/{s}{s}{s})\n", .{ label, @errorName(err), op, op_detail, sep, explanation });
std.debug.print("error: {s} failed: {s}\n", .{ label, @errorName(err) });
}
fn readSource(allocator: std.mem.Allocator, io: std.Io, input_path: []const u8) ![:0]const u8 {