mirror of
https://github.com/HeyPuter/gex.git
synced 2026-11-13 20:12:43 -10:00
Every Worker built an export wrapper, a name and a property for each function a native wasm32 library exports, and the loader then put most of them in the function table by name (`X`). KDE's boot set exports about 150,000 functions and imports one in eight by name: in plasmashell's Worker those wrappers, names and export dictionaries were about 28 of its 40 MiB of JS heap. The page now rewrites each such module before compiling it (`packExports`, its own module key): the function exports not called by name and the constant globals go, and the `X` slots are filled by added element segments. An import of a dropped export comes from its slot or value, which the binding list's `E` line now carries. A module of another shape (fpcast thunks, more than one table, a lowered 64-bit one) is compiled as it was. GEX_LOG=nodlpack keeps the old way, GEX_LOG=dlpack says what was packed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_c8c04c00da9a4525ab21b0b9f146c598