P5.2: emit_object() -> string query primitive

The compiler emits the sx object eagerly (the Zig driver, before the post-link
callback), so emit_object is a QUERY (not an action): it returns the path from
a new BuildConfig.object_path field main.zig forwards — no driver vtable. This
completes the build-pipeline QUERY primitives (emit_object / c_object_paths /
link_libraries); only link (the genuine action) remains for the vtable step.

Extended examples/1662 to also assert emit_object().len > 0. 703/0 both gates.
This commit is contained in:
agra
2026-06-19 07:58:59 +03:00
parent 44dfdcddf9
commit 83de0fa04d
8 changed files with 57 additions and 19 deletions

View File

@@ -1469,6 +1469,17 @@ pub const Vm = struct {
return self.failMsg("comptime link_libraries: no build config threaded into the VM");
return try self.makeStringList(table, result_ty, bc.link_libraries);
}
// `emit_object() -> string` — the compiler emits the object eagerly (the Zig
// driver, before the post-link callback); this returns its path. A query,
// not an action — so no driver callback is needed (unlike `link`).
if (std.mem.eql(u8, name, "emit_object")) {
if (args.len != 0) return self.failMsg("comptime emit_object: expected no args");
const bc = self.build_config orelse
return self.failMsg("comptime emit_object: no build config threaded into the VM");
const path = bc.object_path orelse
return self.failMsg("comptime emit_object: no object was emitted (object_path unset)");
return try self.makeStringValue(table, path);
}
return null; // not a known compiler function → caller bails to legacy
}