P5.7 Step B1: remove the compiler_call IR op + the hook Registry
The compiler_call op + #compiler hook mechanism was fully superseded by abi(.compiler) VM-native dispatch (P5.5) — no sx code emits it anymore. Remove: the compiler_call op variant + CompilerCall struct (inst.zig); the Builder.compilerCall emitter (module.zig); the two dead producer blocks in lower/call.zig (compiler_expr-bodied free fns + methods); every consumer switch arm (emit_llvm, ops.emitCompilerCall, print, interp dispatch); the interp.hooks field + init/deinit. Strip compiler_hooks.zig down to the still- live BuildConfig / BuildHooks / AssetDir (delete HookError/HookFn/Registry/ registerDefaults + all hookXxx, and the now-unused interp/Value imports). Test refs that used compiler_call as a sample unported op now use vec_splat. 501/501 unit + 706/0 corpus.
This commit is contained in:
@@ -1314,12 +1314,12 @@ test "comptime_vm tryEval: pure function → Value; unsupported → null" {
|
||||
const v = vm.tryEval(alloc, &module, ok_id, null, null) orelse return error.VmShouldHaveHandledIt;
|
||||
try std.testing.expectEqual(@as(i64, 42), v.int);
|
||||
|
||||
// fn bad() { compiler_call() } → an unported op → tryEval yields null (caller
|
||||
// falls back to legacy). (box_any/unbox_any are now VM-native; compiler_call is
|
||||
// still unported until Phase 4D.)
|
||||
// fn bad() { vec_splat(...) } → an unported op → tryEval yields null. The VM
|
||||
// bails loudly on any op it does not model (never a silent default); vec_splat
|
||||
// is a stable example of one.
|
||||
var fb2 = Fb.init(alloc, &.{}, .void);
|
||||
const c0 = fb2.block(&.{});
|
||||
_ = fb2.add(c0, inst(.{ .compiler_call = .{ .name = 0, .args = &.{} } }, .void));
|
||||
_ = fb2.add(c0, inst(.{ .vec_splat = .{ .operand = ref(0) } }, .void));
|
||||
_ = fb2.add(c0, inst(.ret_void, .void));
|
||||
const bad_id = module.addFunction(fb2.func);
|
||||
|
||||
@@ -1341,18 +1341,18 @@ test "comptime_vm exec: division by zero and unsupported op bail loudly" {
|
||||
try std.testing.expectEqual(@as(i64, 4), toI64(try v.run(&fb.func, &.{ fromI64(12), fromI64(3) })));
|
||||
try std.testing.expectError(error.DivisionByZero, v.run(&fb.func, &.{ fromI64(12), fromI64(0) }));
|
||||
}
|
||||
// A not-yet-ported op (compiler_call) → Unsupported with the op name in `detail`.
|
||||
// A not-yet-ported op (vec_splat) → Unsupported with the op name in `detail`.
|
||||
{
|
||||
var fb = Fb.init(std.testing.allocator, &.{}, .void);
|
||||
defer fb.deinit();
|
||||
const b0 = fb.block(&.{});
|
||||
_ = fb.add(b0, inst(.{ .compiler_call = .{ .name = 0, .args = &.{} } }, .void));
|
||||
_ = fb.add(b0, inst(.{ .vec_splat = .{ .operand = ref(0) } }, .void));
|
||||
_ = fb.add(b0, inst(.ret_void, .void));
|
||||
|
||||
var v = vm.Vm.init(std.testing.allocator);
|
||||
defer v.deinit();
|
||||
try std.testing.expectError(error.Unsupported, v.run(&fb.func, &.{}));
|
||||
try std.testing.expectEqualStrings("compiler_call", v.detail.?);
|
||||
try std.testing.expectEqualStrings("vec_splat", v.detail.?);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user