Remove the MemoryStyle enum#9583
Merged
Merged
Conversation
There are no more major users left, only a few minor pieces here and there. This should complete the refactoring to delete the "static" and "dynamic" terminology from Wasmtime and all we're left with are linear memories with a few knobs in `Tunables`.
fitzgen
approved these changes
Nov 7, 2024
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 9, 2026
This commit fixes a mistake that was introduced in bytecodealliance#9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`.
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 9, 2026
This commit fixes a mistake that was introduced in bytecodealliance#9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`.
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 9, 2026
This commit fixes a mistake that was introduced in bytecodealliance#9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`.
alexcrichton
added a commit
that referenced
this pull request
Apr 9, 2026
* Fix pooling allocator predicate to reset VM permissions This commit fixes a mistake that was introduced in #9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`. * winch: Fix the type of the `table.size` output register This commit corrects the tagged size of the output of the `table.size` instruction. Previously this was hardcoded as a 32-bit integer instead of consulting the table's index type to use the index-type-sized-register instead. * winch: Fix a host panic when executing `table.fill` This commit fixes a possible panic when a Winch-compiled module executes the `table.fill` instruction. Refactoring in #11254 updated Cranelift but forgot to update Winch meaning that Winch's indices were still using the module-level indices instead of the `DefinedTableIndex` space. This adds some tests and updates Winch's translation to use preexisting helpers. * x64: Fix `f64x2.splat` without SSE3 Don't sink a load into `pshufd` which loads 16 bytes, instead force `put_in_xmm` to ensure only 8 bytes are loaded. * Properly verify alignment in string transcoding This commit updates string transcoding between guest modules to properly verify alignment. Previously alignment was only verified on the first allocation, not reallocations, which is not spec-compliant. This additionally fixes a possible host panic when dealing with unaligned pointers. * Fix type confusion in AArch64 amode RegScaled folding * winch: Add add_uextend to perform explicit extension when needed. This commit fixes an out-of-bounds access caused by the lack zero extension in the code responsible for calculating the heap address for loads/stores. This issue manifests in aarch64 (unlike x64) given that no automatic extension is performed, resulting in an out-of-bounds access. An alternative approach is to emit an extend for the index, however this approach is preferred given that it gives the MacroAssembler layer better control of how to lower addition, e.g., in aarch64 we can inline the desired extension in a single instruction. * winch: Correctly type the result of table.grow This commit fixes an out-of-bounds access caused by the lack of type narrowing from the `table.grow` builtin. Without explicit narrowing, the type is treated as 64-bit value, which could cause issues when paired with loads/stores. * Review comments * Properly handle table index types Only narrow when dealing with the 64-bit pointer/32-bit tables * Fix panic with out-of-bounds flags in `Value` This commit fixes a panic when a component model `Value` is lifted from a flags value which specifies out-of-bounds bits as 1. This is specified in the component model to ignore the out-of-bounds bits, which `flags!` correctly did (and thus `bindgen!`), but `Value` treated out-of-bounds bits as a panic due to indexing an array. * Fix bounds checks in FACT's `string_to_compact` method We need to bounds check the source byte length, not the number of code units. * Add missing realloc validation in string transcoding This commit adds a missing validation that a return value of `realloc` is inbounds during string transcoding. This was accidentally missing on the transcoding path from `utf8` to `latin1+utf16` which meant that a nearly-raw pointer could get passed to the host to perform the transcode. * winch: Refine zero extension heuristic This commit refines the zero extension heuristic such that it unconditionally emits a zero extension when dealing with 32-bit heaps. This eliminates any ambiguity related to the value of the memory indices across ISAs. * Add release notes --------- Co-authored-by: Shun Kashiwa <shunthedev@gmail.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com> Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
alexcrichton
added a commit
that referenced
this pull request
Apr 9, 2026
* Fix pooling allocator predicate to reset VM permissions This commit fixes a mistake that was introduced in #9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`. * winch: Fix the type of the `table.size` output register This commit corrects the tagged size of the output of the `table.size` instruction. Previously this was hardcoded as a 32-bit integer instead of consulting the table's index type to use the index-type-sized-register instead. * winch: Fix a host panic when executing `table.fill` This commit fixes a possible panic when a Winch-compiled module executes the `table.fill` instruction. Refactoring in #11254 updated Cranelift but forgot to update Winch meaning that Winch's indices were still using the module-level indices instead of the `DefinedTableIndex` space. This adds some tests and updates Winch's translation to use preexisting helpers. * x64: Fix `f64x2.splat` without SSE3 Don't sink a load into `pshufd` which loads 16 bytes, instead force `put_in_xmm` to ensure only 8 bytes are loaded. * Properly verify alignment in string transcoding This commit updates string transcoding between guest modules to properly verify alignment. Previously alignment was only verified on the first allocation, not reallocations, which is not spec-compliant. This additionally fixes a possible host panic when dealing with unaligned pointers. * Fix type confusion in AArch64 amode RegScaled folding * winch: Add add_uextend to perform explicit extension when needed. This commit fixes an out-of-bounds access caused by the lack zero extension in the code responsible for calculating the heap address for loads/stores. This issue manifests in aarch64 (unlike x64) given that no automatic extension is performed, resulting in an out-of-bounds access. An alternative approach is to emit an extend for the index, however this approach is preferred given that it gives the MacroAssembler layer better control of how to lower addition, e.g., in aarch64 we can inline the desired extension in a single instruction. * winch: Correctly type the result of table.grow This commit fixes an out-of-bounds access caused by the lack of type narrowing from the `table.grow` builtin. Without explicit narrowing, the type is treated as 64-bit value, which could cause issues when paired with loads/stores. * Review comments * Properly handle table index types Only narrow when dealing with the 64-bit pointer/32-bit tables * Fix panic with out-of-bounds flags in `Value` This commit fixes a panic when a component model `Value` is lifted from a flags value which specifies out-of-bounds bits as 1. This is specified in the component model to ignore the out-of-bounds bits, which `flags!` correctly did (and thus `bindgen!`), but `Value` treated out-of-bounds bits as a panic due to indexing an array. * Fix bounds checks in FACT's `string_to_compact` method We need to bounds check the source byte length, not the number of code units. * Add missing realloc validation in string transcoding This commit adds a missing validation that a return value of `realloc` is inbounds during string transcoding. This was accidentally missing on the transcoding path from `utf8` to `latin1+utf16` which meant that a nearly-raw pointer could get passed to the host to perform the transcode. * winch: Refine zero extension heuristic This commit refines the zero extension heuristic such that it unconditionally emits a zero extension when dealing with 32-bit heaps. This eliminates any ambiguity related to the value of the memory indices across ISAs. * Add release notes --------- Co-authored-by: Shun Kashiwa <shunthedev@gmail.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com> Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
alexcrichton
added a commit
that referenced
this pull request
Apr 9, 2026
* fix(environ): repair unsound StringPool::try_clone() The 43.0 release introduced a soundness bug in StringPool::try_clone(): the cloned map retains &'static str keys pointing into the original pool's strings storage. Once the original Linker is dropped those keys dangle. Cloning a Linker, then dropping the original one, leaves a linker whose registered imports could no longer be found, causing instantiation to fail with "unknown import". Signed-off-by: Flavio Castelli <fcastelli@suse.com> * Fix pooling allocator predicate to reset VM permissions This commit fixes a mistake that was introduced in #9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`. * winch: Fix the type of the `table.size` output register This commit corrects the tagged size of the output of the `table.size` instruction. Previously this was hardcoded as a 32-bit integer instead of consulting the table's index type to use the index-type-sized-register instead. * winch: Fix a host panic when executing `table.fill` This commit fixes a possible panic when a Winch-compiled module executes the `table.fill` instruction. Refactoring in #11254 updated Cranelift but forgot to update Winch meaning that Winch's indices were still using the module-level indices instead of the `DefinedTableIndex` space. This adds some tests and updates Winch's translation to use preexisting helpers. * x64: Fix `f64x2.splat` without SSE3 Don't sink a load into `pshufd` which loads 16 bytes, instead force `put_in_xmm` to ensure only 8 bytes are loaded. * Properly verify alignment in string transcoding This commit updates string transcoding between guest modules to properly verify alignment. Previously alignment was only verified on the first allocation, not reallocations, which is not spec-compliant. This additionally fixes a possible host panic when dealing with unaligned pointers. * Fix type confusion in AArch64 amode RegScaled folding * winch: Add add_uextend to perform explicit extension when needed. This commit fixes an out-of-bounds access caused by the lack zero extension in the code responsible for calculating the heap address for loads/stores. This issue manifests in aarch64 (unlike x64) given that no automatic extension is performed, resulting in an out-of-bounds access. An alternative approach is to emit an extend for the index, however this approach is preferred given that it gives the MacroAssembler layer better control of how to lower addition, e.g., in aarch64 we can inline the desired extension in a single instruction. * winch: Correctly type the result of table.grow This commit fixes an out-of-bounds access caused by the lack of type narrowing from the `table.grow` builtin. Without explicit narrowing, the type is treated as 64-bit value, which could cause issues when paired with loads/stores. * Review comments * Properly handle table index types Only narrow when dealing with the 64-bit pointer/32-bit tables * Fix panic with out-of-bounds flags in `Value` This commit fixes a panic when a component model `Value` is lifted from a flags value which specifies out-of-bounds bits as 1. This is specified in the component model to ignore the out-of-bounds bits, which `flags!` correctly did (and thus `bindgen!`), but `Value` treated out-of-bounds bits as a panic due to indexing an array. * Fix bounds checks in FACT's `string_to_compact` method We need to bounds check the source byte length, not the number of code units. * Add missing realloc validation in string transcoding This commit adds a missing validation that a return value of `realloc` is inbounds during string transcoding. This was accidentally missing on the transcoding path from `utf8` to `latin1+utf16` which meant that a nearly-raw pointer could get passed to the host to perform the transcode. * winch: Refine zero extension heuristic This commit refines the zero extension heuristic such that it unconditionally emits a zero extension when dealing with 32-bit heaps. This eliminates any ambiguity related to the value of the memory indices across ISAs. * Add release notes --------- Signed-off-by: Flavio Castelli <fcastelli@suse.com> Co-authored-by: Flavio Castelli <fcastelli@suse.com> Co-authored-by: Shun Kashiwa <shunthedev@gmail.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com> Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 9, 2026
This commit fixes a mistake that was introduced in bytecodealliance#9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`.
alexcrichton
added a commit
that referenced
this pull request
Apr 9, 2026
* fix(environ): repair unsound StringPool::try_clone() The 43.0 release introduced a soundness bug in StringPool::try_clone(): the cloned map retains &'static str keys pointing into the original pool's strings storage. Once the original Linker is dropped those keys dangle. Cloning a Linker, then dropping the original one, leaves a linker whose registered imports could no longer be found, causing instantiation to fail with "unknown import". Signed-off-by: Flavio Castelli <fcastelli@suse.com> * Fix pooling allocator predicate to reset VM permissions This commit fixes a mistake that was introduced in #9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`. * winch: Fix the type of the `table.size` output register This commit corrects the tagged size of the output of the `table.size` instruction. Previously this was hardcoded as a 32-bit integer instead of consulting the table's index type to use the index-type-sized-register instead. * winch: Fix a host panic when executing `table.fill` This commit fixes a possible panic when a Winch-compiled module executes the `table.fill` instruction. Refactoring in #11254 updated Cranelift but forgot to update Winch meaning that Winch's indices were still using the module-level indices instead of the `DefinedTableIndex` space. This adds some tests and updates Winch's translation to use preexisting helpers. * x64: Fix `f64x2.splat` without SSE3 Don't sink a load into `pshufd` which loads 16 bytes, instead force `put_in_xmm` to ensure only 8 bytes are loaded. * Properly verify alignment in string transcoding This commit updates string transcoding between guest modules to properly verify alignment. Previously alignment was only verified on the first allocation, not reallocations, which is not spec-compliant. This additionally fixes a possible host panic when dealing with unaligned pointers. * Fix type confusion in AArch64 amode RegScaled folding * winch: Add add_uextend to perform explicit extension when needed. This commit fixes an out-of-bounds access caused by the lack zero extension in the code responsible for calculating the heap address for loads/stores. This issue manifests in aarch64 (unlike x64) given that no automatic extension is performed, resulting in an out-of-bounds access. An alternative approach is to emit an extend for the index, however this approach is preferred given that it gives the MacroAssembler layer better control of how to lower addition, e.g., in aarch64 we can inline the desired extension in a single instruction. * winch: Correctly type the result of table.grow This commit fixes an out-of-bounds access caused by the lack of type narrowing from the `table.grow` builtin. Without explicit narrowing, the type is treated as 64-bit value, which could cause issues when paired with loads/stores. * Review comments * Properly handle table index types Only narrow when dealing with the 64-bit pointer/32-bit tables * Fix panic with out-of-bounds flags in `Value` This commit fixes a panic when a component model `Value` is lifted from a flags value which specifies out-of-bounds bits as 1. This is specified in the component model to ignore the out-of-bounds bits, which `flags!` correctly did (and thus `bindgen!`), but `Value` treated out-of-bounds bits as a panic due to indexing an array. * Fix bounds checks in FACT's `string_to_compact` method We need to bounds check the source byte length, not the number of code units. * Add missing realloc validation in string transcoding This commit adds a missing validation that a return value of `realloc` is inbounds during string transcoding. This was accidentally missing on the transcoding path from `utf8` to `latin1+utf16` which meant that a nearly-raw pointer could get passed to the host to perform the transcode. * winch: Refine zero extension heuristic This commit refines the zero extension heuristic such that it unconditionally emits a zero extension when dealing with 32-bit heaps. This eliminates any ambiguity related to the value of the memory indices across ISAs. * Fix failure on 32-bit * Fix miri test --------- Signed-off-by: Flavio Castelli <fcastelli@suse.com> Co-authored-by: Flavio Castelli <fcastelli@suse.com> Co-authored-by: Shun Kashiwa <shunthedev@gmail.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com> Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Apr 9, 2026
This commit fixes a mistake that was introduced in bytecodealliance#9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`.
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 9, 2026
* Fix pooling allocator predicate to reset VM permissions This commit fixes a mistake that was introduced in #9583 where the logic to reset a linear memory slot in the pooling allocator used the wrong predicate. Specifically VM permissions must be reset if virtual memory can be relied on at all, and the preexisting predicate of `can_elide_bounds_check` was an inaccurate representation of this. The correct predicate to check is `can_use_virtual_memory`. * Fix failure on 32-bit
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.
There are no more major users left, only a few minor pieces here and there. This should complete the refactoring to delete the "static" and "dynamic" terminology from Wasmtime and all we're left with are linear memories with a few knobs in
Tunables.