P5.2 metadata queries: c_object_paths / link_libraries on the VM
Two abi(.compiler) build-pipeline primitives the sx driver will pass to link: - c_object_paths() -> List(string) (#import c companion objects) - link_libraries() -> List(string) (#library names) They live in a new stdlib home library/modules/std/build.sx and are serviced by comptime_vm.callCompilerFn reading two new BuildConfig fields that main.zig forwards before the post-link callback. New reusable VM helper makeStringList builds a List(string) in flat memory from the call's result type offsets (target-aware); invoke/callCompilerFn now thread ins.ty for that. Legacy handlers bail loudly (VM-only by nature — post-link; List(string) isn't faithfully buildable in the legacy Value model, 0141). Smoke test examples/1662-platform-build-pipeline-queries (AOT + a 1-line C #source → one object): a post-link callback verifies the VM-built list is well-formed; build exit 0 only if so (negative-probe confirmed a real guard). emit_object + link (the actions) deferred to P5.2b — they replace the Zig driver's auto-emit/auto-link and need a host-installed callback vtable. 703/0 both gates.
This commit is contained in:
@@ -504,8 +504,15 @@ The compiler's whole post-IR role: codegen → build the CLI-derived `BuildConfi
|
||||
`examples/1661-platform-post-link-vm-list` (AOT): a post-link callback GROWS a `List` (0141 — works on the VM,
|
||||
bails on legacy with `struct_get`), so the build succeeds (exit 0) only via the VM. Non-empty callback `args`
|
||||
rejected loudly (the `on_build(config)` arg-marshaling entry is P5.3). **702/0 both gates.**
|
||||
- **P5.2 — primitives:** expose `emit_object` + `link` (reuse `target.zig` linker) + metadata queries
|
||||
(`c_object_paths`/`link_libraries`/host-triple) as `abi(.compiler)` fns taking explicit args.
|
||||
- **P5.2 — primitives.** Split: the read-only **metadata queries are DONE (2026-06-19)** — `c_object_paths() ->
|
||||
List(string)` + `link_libraries() -> List(string)` as `abi(.compiler)` fns (stdlib `library/modules/std/build.sx`),
|
||||
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.
|
||||
- **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