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:
@@ -1,17 +1,20 @@
|
||||
#import "modules/std.sx";
|
||||
#import "modules/build.sx";
|
||||
#import "modules/compiler.sx";
|
||||
|
||||
// P5.3 smoke test — `on_build(build)` registers the build callback (the Phase 5
|
||||
// form), and the compiler invokes it post-codegen WITH the BuildOptions handle
|
||||
// as an arg (`build :: (opt: BuildOptions) -> bool`). This exercises the VM
|
||||
// entry that passes an explicit arg after the implicit context (runEntryArgs).
|
||||
// The callback uses the build-pipeline primitives (no opt accessors yet) and
|
||||
// returns true; AOT observes success via the build exit code.
|
||||
// P5.4 — the `on_build` override. A user `#run on_build(build);` replaces the
|
||||
// stdlib `default_pipeline` as the build driver; the compiler invokes it after
|
||||
// codegen with the `BuildOptions` handle. This build GROWS a `List` on the build
|
||||
// VM (comptime List growth works only on the VM — issue 0141; the legacy interp
|
||||
// fails it) then DELEGATES to `default_pipeline` for the real emit + link, so a
|
||||
// working binary is still produced → "runtime main".
|
||||
|
||||
build :: (opt: BuildOptions) -> bool abi(.compiler) {
|
||||
obj := emit_object();
|
||||
return obj.len > 0;
|
||||
names := List(string).{};
|
||||
names.append("alpha");
|
||||
names.append("beta");
|
||||
names.append("gamma");
|
||||
if names.len != 3 { return false; }
|
||||
return default_pipeline(opt);
|
||||
}
|
||||
#run on_build(build);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user