Uh oh!
There was an error while loading. Please reload this page.
[Wasm RyuJIT] Block stores - #123738
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
kg
commented
Jan 28, 2026
Not sure what i'm doing wrong here yet. |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR implements infrastructure for WebAssembly block store operations in the RyuJIT compiler. It adds support for lowering block copy and initialization operations to use WASM-specific memory.copy and memory.fill instructions.
Changes:
- Adds
LowerBlockStoreimplementation for WASM target to handle block copy and initialization operations - Introduces two new WASM instructions (
memory_copyandmemory_fill) and their associated instruction format (IF_MEMCPY) - Adds emitter support for encoding and displaying the new IF_MEMCPY instruction format
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/coreclr/jit/lowerwasm.cpp | Implements LowerBlockStore to handle GT_STORE_BLK and GT_INIT_BLK operations, with partial infrastructure for memory.copy and memory.fill |
| src/coreclr/jit/instrswasm.h | Adds memory_copy and memory_fill instruction definitions with their opcodes |
| src/coreclr/jit/emitfmtswasm.h | Defines the IF_MEMCPY instruction format for memory operations with two memory indices |
| src/coreclr/jit/emitwasm.cpp | Implements encoding, size calculation, and display logic for IF_MEMCPY instruction format |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kg
commented
Feb 18, 2026
cc @adamperlin see the WasmLowering.GetSignature changes. I couldn't figure out what was wrong with the existing implementation so I rewrote it, but the rewrite isn't complete. It was generating signatures with zeroes in them and that produced invalid wasm modules. |
AndyAyersMS
commented
Feb 18, 2026
That's probably my fault: I revised that code to try and handle the return buffer placement. @MichalStrehovsky in the managed type system signatures is the |
MichalStrehovsky
commented
Feb 19, 2026
If you mean the
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The re-write looks good to me, appending to a list seems like an easier solution to ensure correctness. My only feedback would just be that we should probably add a comment (maybe in the header) explaining what the maximum number of parameters we might add when lowering the signature is (explaining the |
kg
commented
Feb 19, 2026
@dotnet/jit-contrib PTAL |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Looks good overall, just curious about the GC disabling part.
Uh oh!
There was an error while loading. Please reload this page.
Add insns for memory copy and fill Remove NYIs so stuff can flow through Cleanup Checkpoint Fix opcodes Fix WasmLowering.GetSignature Maybe-working codegen for zeroing a struct jit-format Remove unused local Consume operands Fix erroneous fallthrough Address PR feedback Remove dead call NotImplementedException ArrayBuilder and comment Make initblk loop work
Remove else case
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kg
commented
Feb 23, 2026
Resolving all comments to merge as-is. Issues will be fixed in follow-up PRs. |
Uh oh!
There was an error while loading. Please reload this page.
Partial implementation of block stores for wasm - handles copies and zeroing of structs via refs and pointers, but not fields or locals yet. Does not handle nonzero init values yet. --------- Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This is sufficient to compile these three managed methods to wasm functions with native
memory.fillandmemory.copyinstructions: