Documentation
¶
Overview ¶
Command wasmpack shrinks a Go js/wasm binary after linking.
On wasm the linker gives every function 64 KiB of PC space, so runtime.findfunctab holds 320 bytes per function: sixteen buckets, each the function's index followed by sixteen zero bytes. wasmpack removes that table from the data section and adds a start function that writes it back at instantiation. It then re-splits the remaining data around runs of zeroes, which the linker stops doing once the table has used up its segment budget.
The table is found by its content and only removed when the start function reproduces it byte for byte, so memory after instantiation is unchanged. A module without such a table is left as it is.