[multibyte] Add multibyte array store instructions.#8059
Open
brendandahl wants to merge 14 commits intoWebAssembly:mainfrom
Open
[multibyte] Add multibyte array store instructions.#8059brendandahl wants to merge 14 commits intoWebAssembly:mainfrom
brendandahl wants to merge 14 commits intoWebAssembly:mainfrom
Conversation
tlively
reviewed
Nov 19, 2025
src/wasm.h
Outdated
Comment on lines
+1846
to
+1847
| // TODO is this needed? | ||
| MemoryOrder order = MemoryOrder::Unordered; |
Member
There was a problem hiding this comment.
Probably in the long run, but not urgently. I would leave it out for now.
src/wasm/wasm-binary.cpp
Outdated
| case BinaryConsts::I32StoreMem8: { | ||
| auto [mem, align, offset] = getMemarg(); | ||
| return builder.makeStore(1, offset, align, Type::i32, mem); | ||
| auto [mem, align, offset, backing] = getMemargWithBacking(); |
Member
There was a problem hiding this comment.
The binary format will need the type immediate as well, so this will have to look something like this:
Suggested change
| auto [mem, align, offset, backing] = getMemargWithBacking(); | |
| auto [mem, align, offset, backing] = getMemargWithBacking(); | |
| if (backing == BackingType::Array) { | |
| HeapType type = getIndexedHeapType(); | |
| ... |
At that point we might as well add a separate IRBuilder method for making array stores, which should help separate concerns more.
46cdca3 to
60f68c8
Compare
0a6ba01 to
2f3a132
Compare
Add support for multibyte array store instructions as proposed in the WebAssembly multibyte proposal. These instructions allow storing values of various byte widths directly into i8 arrays, avoiding the need for manual bit manipulation and masking. Link: https://github.com/WebAssembly/multibyte
2f3a132 to
0847ada
Compare
tlively
reviewed
Mar 4, 2026
kripken
reviewed
Mar 5, 2026
tlively
approved these changes
Mar 6, 2026
| } | ||
| note(&curr->ref, Type(*ht, Nullable)); | ||
| note(&curr->index, Type::i32); | ||
| note(&curr->value, valueType ? *valueType : curr->value->type); |
Member
There was a problem hiding this comment.
We should self().noteUnknown() if curr->value->type == Type::unreachable.
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.
Prototype implementation of the new multibyte array proposal that reuses the existing memory instructions.
The syntax for the new instructions is as follows:
<i32|i64|f32|f64>.store (type $type_idx) <array ref> <index> <value>Some spec related TODOs:
i32.store type=array x yori32.store array x yor ???Some implementation TODOs:
visitArrayStorefunctions and implement them or make sure the copied versions makes sense.WasmBinaryReader::getMemarg