Support global.get in more constant expressions#7996
Merged
fitzgen merged 1 commit intobytecodealliance:mainfrom Feb 26, 2024
Merged
Support global.get in more constant expressions#7996fitzgen merged 1 commit intobytecodealliance:mainfrom
global.get in more constant expressions#7996fitzgen merged 1 commit intobytecodealliance:mainfrom
Conversation
This commit updates Wasmtime to support `global.get` in constant expressions when located in table initializers and element segments. Pre-reference-types this never came up because there was no valid `global.get` that would typecheck. After the reference-types proposal landed however this became possible but Wasmtime did not support it. This was surfaced in bytecodealliance#6705 when the spec test suite was updated and has a new test that exercises this functionality. This commit both updates the spec test suite and additionally adds support for this new form of element segment and table initialization expression. The fact that Wasmtime hasn't supported this until now also means that we have a gap in our fuzz-testing infrastructure. The `wasm-smith` generator is being updated in bytecodealliance/wasm-tools#1426 to generate modules with this particular feature and I've tested that with that PR fuzzing here eventually generates an error before this PR. Closes bytecodealliance#6705
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Feb 28, 2024
This fixes a mistake introduced in bytecodealliance#7996 where a `global.get` used to initialize a table did not properly drop previous items in the table causing them to leak as the reference count was not decremented.
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 commit updates Wasmtime to support
global.getin constant expressions when located in table initializers and element segments. Pre-reference-types this never came up because there was no validglobal.getthat would typecheck. After the reference-types proposal landed however this became possible but Wasmtime did not support it. This was surfaced in #6705 when the spec test suite was updated and has a new test that exercises this functionality.This commit both updates the spec test suite and additionally adds support for this new form of element segment and table initialization expression.
The fact that Wasmtime hasn't supported this until now also means that we have a gap in our fuzz-testing infrastructure. The
wasm-smithgenerator is being updated in bytecodealliance/wasm-tools#1426 to generate modules with this particular feature and I've tested that with that PR fuzzing here eventually generates an error before this PR.Closes #6705