You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(module
(type $none (func))
;; A table that is initially only used by a function we will move
(table $tab 1 funcref)
(func $f (type $none))
(func $use_table (type $none)
(call_indirect $tab (type $none) (i32.const 0))
)
;; A global that refers to $f.
;; Crucially, wasm-split skips globals in its first indirection pass.
(global $g (mut funcref) (ref.func $f))
(export "g" (global $g))
(export "use_table" (func $use_table))
)
This moves $f to the second module, but leaves a direct call to it in the $trampoline_f function added to the primary module, causing an assertion failure in the binary writer.
Explanation from Gemini:
Function Moving: $f and $use_table are moved to s.wasm.
Sharing Phase: wasm-split analyzes p.wasm. It sees that $tab is no longer used in the primary module (since the only caller was moved) and is used in the secondary module. It moves the table from p.wasm to
s.wasm.
Trampoline Creation: During the same sharing phase, it sees that global $g in p.wasm still refers to the moved function $f. It creates a trampoline in p.wasm to call $f.
Indirection: The trampoline needs to call $f indirectly. Since the original table was already moved to the secondary module, wasm-split creates a new, second table in p.wasm to hold the slot for $f.
Patching Failure: The secondary module contains logic to patch the table entries for $f. However, it patches the original moved table it now owns, while the primary module's trampoline is calling through
the newly created table.
Execution Mismatch: When you call into the primary module's table, it hits an uninitialized entry (or a placeholder that throws an exception), even though the secondary module "successfully" patched what it
thought was the correct table.
Gemini fixed this by adding additional calls to indirectCallsToSecondaryFunctions and setupTablePatching at the end of the pipeline, but I doubt this is the best solution.
Activity
tlively commentedon Mar 24, 2026
Found another one:
This moves
$fto the second module, but leaves a direct call to it in the$trampoline_ffunction added to the primary module, causing an assertion failure in the binary writer.Explanation from Gemini:
Gemini fixed this by adding additional calls to
indirectCallsToSecondaryFunctionsandsetupTablePatchingat the end of the pipeline, but I doubt this is the best solution.[wasm-split] Pre-create trampolines for global initializers
[wasm-split] Pre-create trampolines for global initializers
kripken commentedon Apr 6, 2026
If there isn't a quick fix here, should we disable the Split fuzzer for now? (That is what I've been doing locally.)
tlively commentedon Apr 6, 2026
I have also been doing that locally. Temporarily disabling it upstream would be a good simplification.
Temporarily disable Split in fuzz_opt
Temporarily disable Split in fuzz_opt (#8575)
[wasm-split] Split module elements early
[wasm-split] Split module elements early (WebAssembly#8688)