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:
@@ -509,10 +509,13 @@ The compiler's whole post-IR role: codegen → build the CLI-derived `BuildConfi
|
||||
serviced by `comptime_vm.callCompilerFn` over `BuildConfig` fields `main.zig` forwards; new VM `makeStringList`
|
||||
builds the `List(string)` in flat memory from the call's result type (`ins.ty` now threaded through
|
||||
`invoke`/`callCompilerFn`). Smoke test `1662-platform-build-pipeline-queries` (AOT + C companion). 703/0 both
|
||||
gates. **P5.2b — the ACTIONS (`emit_object -> !string`, `link(...) -> !`, reuse `target.zig`):** still TODO —
|
||||
they replace the Zig driver's auto-emit/auto-link, so they need the driver restructuring + a host-installed
|
||||
callback vtable (`comptime_vm.zig` can't depend on `core`/`main`/`target`); `link`'s fallible `-> !` return is
|
||||
the new VM shape.
|
||||
gates. **`emit_object() -> string` is also DONE (2026-06-19)** as a QUERY (not an action): the Zig driver emits
|
||||
the object eagerly, so the primitive just returns the path from `BuildConfig.object_path` (no vtable). So all
|
||||
three QUERY primitives are done. **P5.2b — `link(...) -> !` (the one genuine ACTION):** still TODO — it replaces
|
||||
the Zig driver's auto-link, so it needs the driver restructuring + a host-installed callback vtable
|
||||
(`comptime_vm.zig` can't depend on `core`/`main`/`target`) + a `List(string)`-arg reader (inverse of
|
||||
`makeStringList`) + the fallible `-> !` return (a `(value…, tag=0)` tuple, since `!T` is a tuple). Test it via a
|
||||
post-link callback linking to a TEMP output (the Zig driver still links until P5.4).
|
||||
- **P5.3 — `on_build` slot:** a comptime-assignable compiler slot (GENERALIZES today's `post_link_callback_fn`:
|
||||
an assignable typed global with a stdlib default, vs a setter). `#run on_build = build;` captures the
|
||||
`FuncId`; the compiler invokes it post-codegen with the CLI-derived `BuildConfig`.
|
||||
|
||||
Reference in New Issue
Block a user