P5.4: migrate all callers to on_build; delete set_post_link_callback
on_build is now the sole post-build callback mechanism. Migrated the 9 callers (0602/0603/1611/1614/1615/1616 + the platform bundle_main) from opts.set_post_link_callback(cb) to on_build(cb), giving each callback the (opt: BuildOptions) param. Deleted set_post_link_callback from build.sx, compiler_lib (bound_fns + handleSetPostLinkCallback), and the VM arm. Reworked the P5 smoke tests for the new semantics: an on_build override REPLACES the build (must emit+link or delegate), unlike the old post-link callback which ran after the auto-link. 1662 (queries) + 1664 (override+List-grow) now delegate to default_pipeline for the real build; deleted 1661/1663 (the primitives are now exercised by every AOT build). bundle_main invoked with pass_options=true. Benign 37-.ir churn (build.sx shrank). 703/0 both gates.
This commit is contained in:
@@ -1480,18 +1480,6 @@ pub const Vm = struct {
|
||||
if (std.mem.eql(u8, name, "build_options")) {
|
||||
return @as(Reg, null_addr);
|
||||
}
|
||||
// `set_post_link_callback(self, cb)` — record the callback `FuncId` on the
|
||||
// build config so `main.zig` re-enters the evaluator post-link. The cb arg is
|
||||
// a `func_ref` word. Mirrors the legacy `hookSetPostLinkCallback`.
|
||||
if (std.mem.eql(u8, name, "set_post_link_callback")) {
|
||||
if (args.len != 2) return self.failMsg("comptime set_post_link_callback: expected (self, cb)");
|
||||
const bc = self.build_config orelse
|
||||
return self.failMsg("comptime set_post_link_callback: no build config threaded into the VM");
|
||||
const fid = funcRefToId(frame.get(args[1].index())) orelse
|
||||
return self.failMsg("comptime set_post_link_callback: cb arg is not a function value");
|
||||
bc.post_link_callback_fn = fid;
|
||||
return @as(Reg, null_addr);
|
||||
}
|
||||
// `on_build(cb)` — register the build callback (the Phase 5 form, `cb:
|
||||
// (opt: BuildOptions) -> bool`). Like `set_post_link_callback` but a free
|
||||
// fn (cb is arg 0, no self) and the callback receives the `BuildOptions`
|
||||
|
||||
Reference in New Issue
Block a user