Repository navigation
fix(runtime): size effect table to program constructor IDs - #1378
Conversation
Make callback slots volatile so Clang retains constructor registration at runtime instead of embedding the full effect table in initialized data. Dispatch checks and calls one callback value, preserving the registry's external linkage, capacity, static lifetime and registration API.
|
Thanks @vicmcorrea, the diagnosis is right and the fix works. I reproduced it with Apple clang 21 by adding Also worth knowing: Apple clang leaves the table as a common symbol, and that's why dropping One ask: instead of Every CID(k) an effect registers, and every request io_step dispatches, is already a row of CID_T (cid_arity |
Lorenzobattistela
left a comment
There was a problem hiding this comment.
Thanks @vicmcorrea!
Fixes #1163. Clang can fold effect constructors into an initialized 65,536-slot callback table, adding 512 KiB to small native programs with
-fno-common.Size
io_eff_rowsby the generatedCID_Trows, as requested in maintainer review. Generated effect IDs and dispatched requests already share that metadata domain. The runtime diff is one declaration; registration, dispatch, external linkage and diagnostics remain unchanged.The two regression fixtures cover native artifact size below 256 KiB and IO without registered effects. They are unchanged from the initial PR. The native size regression is compiler-dependent: Apple Clang's default common-symbol behavior already passes the original fixture;
-fno-common, Homebrew Clang and Linux Clang reproduce the failure. CLI and JS lanes measure their source entries.Validation:
CID_Tmetadata.-fno-commonand LTO. The original declaration reproduces oversized binaries andFalse; the revised size fixture printsTrue.gpu_markandgpu_reachpass CLI, JS, CPU and Metal. Both new fixtures pass--checkup.git diff --checkand the repository gate pass (50/50).comp.tsmeasures 63,852 ttok on this branch and 63,943 when combined with current main, below the unchanged 64,000 cap.The full cluster test gate cannot resolve the
clusterhost. Full perf, ping, safe and CUDA gates are not claimed.