[wasm-split] Split more active segments for --no-placeholders#8859
Open
aheejin wants to merge 2 commits into
Open
[wasm-split] Split more active segments for --no-placeholders#8859aheejin wants to merge 2 commits into
aheejin wants to merge 2 commits into
Conversation
If placeholders are not used, and if all functions in an element segment belong to a single secondary module, we can move the segment to that secondary module, because those functions aren't available until the secondary module is loaded anyway. The primary module size decreases 5-9% for acx_gallery and essentials. These applications both use `--no-placeholders`. - acx_gallery (07/2025): 9.7% - acx_gallery (05/2026): 5.3% - essentials (04?/2026): 6.3% - essentials (05/2026): 8.4%
tlively
reviewed
Jun 18, 2026
tlively
left a comment
Member
There was a problem hiding this comment.
Nice idea!
There is an edge case where something like array.init_elem references an active element segment. This will trap unless the instruction accesses a slice of length 0 at index 0, so it is generally useless. But it still requires the element segment to be in the same module as the instruction for validation.
Is this edge case handled already? It doesn't seem like it is. One option is to optimize out all the useless instructions that access active element segments before doing anything else. We do something similar in MemoryPacking::optimizeSegmentOps, for instance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If placeholders are not used, and if all functions in an element segment belong to a single secondary module, we can move the segment to that secondary module, because those functions aren't available until the secondary module is loaded anyway.
The primary module size decreases 5-9% for acx_gallery and essentials. These applications both use
--no-placeholders.