plan/checkpoint: #compiler/compiler_call is DELETED not bridged — BuildOptions → abi(.zig) extern compiler
Direction correction (user): the VM does NOT get a transitional compiler_call → hook-registry shim. BuildOptions is re-expressed as abi(.zig) extern compiler functions (the compiler-API the VM already dispatches via callCompilerFn), and the #compiler attribute + compiler_call op + Value-based hook Registry are deleted. Also record that 4D (host FFI) is DONE via the arena/absolute-pointer allocator (the earlier pin/tag hazard is moot — the arena never moves an allocation), and that 0602/0603 stay on legacy fallback until the BuildOptions migration lands. No code change (reverted the speculative compiler_call bridge).
This commit is contained in:
@@ -43,25 +43,26 @@ with ONE welded mechanism. Branch: `reify` (off `master`). Update after every st
|
||||
> example 0636 `toupper`); **4D.2** slice/string args → NUL-term `char*` + float-arg/return guards
|
||||
> (`6a7f690`, example 0637 `strlen([:0]u8)`). **699/0 BOTH gates.**
|
||||
>
|
||||
> **4D.3 findings (for a fast restart):** the corpus drivers are `0602`/`0603` — their `#run
|
||||
> configure()` calls BuildOptions hooks (`build_options`, `BuildOptions.set_post_link_callback`) →
|
||||
> the `.compiler_call` op → currently bails on the VM. The hook ABI is `Value`-based:
|
||||
> `HookFn = fn(interp: *const Interpreter, args: []const Value, bc: *BuildConfig, alloc) HookError!Value`
|
||||
> (`compiler_hooks.zig:103`); the registry is `Registry` (built by `registerDefaults`), reached on the
|
||||
> interp as `self.hooks` + `self.build_config` (`interp.zig:204`/`:201`, set by emit_llvm/core before
|
||||
> the eval). Plan for 4D.3 (transitional Value shim — rewrite the ABI to flat memory only in 4F):
|
||||
> (1) thread `*BuildConfig` (+ the hook `Registry`) into the `Vm` and through `tryEval` from the
|
||||
> emit-time sites (mirror how `interp_inst.build_config` is set at `emit_llvm.zig:860`/`:106x`);
|
||||
> (2) add a `.compiler_call` exec arm: resolve the hook by name, `regToValue` each flat arg → `Value`,
|
||||
> call the hook, `valueToReg` the result. **Open question:** the hooks take `*const Interpreter` —
|
||||
> audit whether any DEREFERENCE it for the arg kinds in play (`.string`/`.func_ref`/`.int` decode via
|
||||
> `asString`/`asFuncRef`, which for a `regToValue`-built Value don't need the interp). If some hook
|
||||
> needs a real interp, the pragmatic transitional route is to pass the `interp_inst` already created
|
||||
> at the emit-time site into `tryEval`. Then `0602`/`0603` should run HANDLED. Dependency-ordered
|
||||
> remainder: **4A leftovers** (out/print [double-output-on-fallback caveat], global_addr, trace,
|
||||
> switch_br for the Any-tag type-switch in 0114/0520–0524/1035) · **4B** VM diagnostics · **4C**
|
||||
> `#insert` · **4E** bundler (+ dedicated bundle tests) · **4F** flip default + delete
|
||||
> `interp.zig`/`Value` + flat-memory `HookFn` + re-express `define`/`make_enum`.
|
||||
> **DIRECTION CORRECTION (2026-06-18, user): `#compiler` / `compiler_call` is DELETED, not bridged
|
||||
> on the VM.** `BuildOptions` is RE-EXPRESSED as **`abi(.zig) extern compiler`** functions (the
|
||||
> compiler-API surface the VM already dispatches via `callCompilerFn`); the `#compiler` attribute, the
|
||||
> `compiler_call` IR op, and the `Value`-based hook `Registry` (`compiler_hooks.zig`) all go away.
|
||||
> So there is **NO transitional `compiler_call`→hooks shim** on the VM (I started one — threading the
|
||||
> legacy interp into `tryEval` for the hook registry — and reverted it; tree clean at `b05c74f`).
|
||||
> `0602`/`0603` stay on legacy fallback until the BuildOptions migration lands. **Migration shape**
|
||||
> (end-state, shares the `BuildConfig`-on-the-VM prerequisite with the bundler 4E): (1) each
|
||||
> `BuildOptions` setter/getter becomes a `compiler` fn in `compiler_lib.bound_fns` + `Vm.callCompilerFn`,
|
||||
> reading flat-memory args + a `*BuildConfig` threaded into the `Vm` (the same `BuildConfig`
|
||||
> `main.zig` forwards); (2) `library/modules/build.sx` declares them `abi(.zig) extern compiler`
|
||||
> instead of `struct #compiler`; (3) delete the `compiler_call` op + `compiler_hooks.zig`
|
||||
> `HookFn`/`Registry` + the `#compiler` parse/lower path. See `PLAN-COMPILER-VM.md` Phase 4.
|
||||
>
|
||||
> **Corpus-driven remainder (independent of the BuildOptions migration):** **4A leftovers** —
|
||||
> out/print (double-output-on-fallback caveat: write directly only once the whole eval is VM-handled),
|
||||
> global_addr, trace, and `switch_br` for the Any-tag type-switch (0114/0520–0524/1035, the box_any
|
||||
> examples that now bail further at `switch_br`/`type_name`) · **4B** VM diagnostics · **4C** `#insert`.
|
||||
> Then the BuildOptions migration + **4E** bundler (+ dedicated bundle tests) + **4F** flip default +
|
||||
> delete `interp.zig`/`Value` + re-express `define`/`make_enum`.
|
||||
> Starting at **4A.1 (box_any/unbox_any)**. See `PLAN-COMPILER-VM.md` → Phase 4 for the full plan +
|
||||
> top risks (flat-pointer escape on buffer realloc; bundler test coverage).
|
||||
> Earlier landed: dedicated `Type` builtin TypeId (`6844fb9`/`94f60c5`/`554871b`); WRITE side
|
||||
|
||||
Reference in New Issue
Block a user