[wasm-split] Support Table::init#8818
Open
aheejin wants to merge 1 commit into
Open
Conversation
This adds support for `Table::init` expressions.
aheejin
commented
Jun 9, 2026
Comment on lines
+765
to
+787
| // We shouldn't use collector.walkModuleCode here, because we don't want to | ||
| // walk global initializers. At this point, all globals are still in the | ||
| // primary module, so if we walk global initializers here, other globals | ||
| // appearing in their initializers will all be marked as used in the primary | ||
| // module, which is not what we want. | ||
| // | ||
| // For example, we have (global $a i32 (global.get $b)). Because $a is at | ||
| // this point still in the primary module, $b will be marked as "used" in | ||
| // the primary module. But $a can be moved to a secondary module later if it | ||
| // is used exclusively by that module. Then $b can be also moved, in case it | ||
| // doesn't have other uses. But if it is marked as "used" in the primary | ||
| // module, it can't. | ||
| walkSegments(collector, &module); | ||
| for (auto& segment : module.dataSegments) { | ||
| if (segment->isActive()) { | ||
| used.memories.insert(segment->memory); | ||
| } | ||
| } | ||
| for (auto& segment : module.elementSegments) { | ||
| if (segment->isActive()) { | ||
| used.tables.insert(segment->table); | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
This part was just moved, because I felt this was tidier
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.
This adds support for
Table::initexpressions.