-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use MemoryStyle
for heap base pointer relocations
#9569
Don't use MemoryStyle
for heap base pointer relocations
#9569
Conversation
Instead add a helper method to `Memory` which indicates whether the base pointer of memory can move. Use this and plumb the result around to the various locations that require it. This improves the `readonly` application of the base pointer in Cranelift by having the optimization kick in in more scenarios. It additionally fixes combining shared linear memories with 64-bit addressing or a page size of 1 by adding a runtime check before relocation of a linear memory that it's allowed to do so. A few codegen tests are added to ensure that `readonly` is applied where it wasn't previously and additionally a new `*.wast` test was added with the cross product of various features of linear memories and some basic tests to ensure that the memories all work as expected. This refactoring fixes two preexisting issues about `shared` memories requiring a "static" memory style. The restriction is now based on whether the pointer can relocate or not and that's upheld via the new trait method added here. To account for these bug fixes the fuzzers have been updated to allow mixing the `threads` proposal with `memory64` or `custom-page-sizes`. Closes bytecodealliance#4267 Closes bytecodealliance#9523
I'll also notably point out that this is incompatible with |
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "fuzzing", "wasmtime:api"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like this clean up, everything is much easier to follow now. Thanks!
This code will be short-lived due to scheduled future refactorings but the idea is that when a "dynamic" memory is chosen the minimum size of the allocation needs to be at least `tunables.memory_reservation` to fit the constraints of the rest of the system, so be sure to factor that in.
ecb7ede
to
29e0875
Compare
Instead add a helper method to
Memory
which indicates whether the base pointer of memory can move. Use this and plumb the result around to the various locations that require it. This improves thereadonly
application of the base pointer in Cranelift by having the optimization kick in in more scenarios. It additionally fixes combining shared linear memories with 64-bit addressing or a page size of 1 by adding a runtime check before relocation of a linear memory that it's allowed to do so.A few codegen tests are added to ensure that
readonly
is applied where it wasn't previously and additionally a new*.wast
test was added with the cross product of various features of linear memories and some basic tests to ensure that the memories all work as expected.This refactoring fixes two preexisting issues about
shared
memories requiring a "static" memory style. The restriction is now based on whether the pointer can relocate or not and that's upheld via the new trait method added here.To account for these bug fixes the fuzzers have been updated to allow mixing the
threads
proposal withmemory64
orcustom-page-sizes
.Closes #4267
Closes #9523