Print tables for call_indirects for nonzero table index#7843
Merged
aheejin merged 2 commits intoWebAssembly:mainfrom Aug 19, 2025
Merged
Print tables for call_indirects for nonzero table index#7843aheejin merged 2 commits intoWebAssembly:mainfrom
aheejin merged 2 commits intoWebAssembly:mainfrom
Conversation
Rather than always printing the table like in WebAssembly#7839, this prints the table only when either reference types is enabled or the table index is not 0 (even if the features section or `--enable-reference-types` is not provided) This addresses the concern in WebAssembly#7802, while not printing table when it is not necessary. There is no test changes because - At the moment wasm-dis enables all features so wasm-dis always prints tables in `call_indirect`s. This will change in WebAssembly#7840. - wasm-opt results didn't print table so far when reference-types is not enabled, and all `call_indirect`s in those tests have table index 0.
kripken
approved these changes
Aug 19, 2025
Co-authored-by: Alon Zakai <alonzakai@gmail.com>
tlively
approved these changes
Aug 19, 2025
aheejin
added a commit
that referenced
this pull request
Aug 26, 2025
This effectively restores pre-#7802 status, except for the case the input binary has the features section. If the binary does not have it, we restore the default features (mutable-global + sign-ext) + whatever is given in the command line before the printing. If the binary has the features section, we just restore it before the printing. This currently does not handle the case when there is the features section and the user gives more features flags in the command line, but in the current interface it is cumbersome to handle. And we were not handling that anyway pre-#7802, so it is not a regression. And we preserve the `FeaturesSet::All` setting at parsing time so @tlively's [concern](#7836 (comment)) will not be an issue. Because we preserve the features section, #7836 will be addressed too. The main motivation for #7802 was `call_indirect` could be incorrectly printed, and that was also separately addressed by #7843. `ModuleReader::getFeaturesSectionFeatures` was adopted from @tlively's commit: ed36a8c Because we don't set the features to `Features::All` at the printing time, `(type $..)` in `(func)` definitions and `(table ..)` in `call_indirect`s have been removed. Fixes #7836.
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.
Rather than always printing the table like in #7839, this prints the table only when either reference types is enabled or the table index is not 0 (even if the features section or
--enable-reference-typesis not provided)This addresses the concern in #7802, while not printing table when it is not necessary.
There is no test changes because
call_indirects. This will change in [wasm-dis] Restore features section in output #7840.call_indirects in those tests have table index 0.