-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Wasm RyuJIT] Block stores #123738
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
base: main
Are you sure you want to change the base?
[Wasm RyuJIT] Block stores #123738
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -319,6 +319,11 @@ unsigned emitter::instrDesc::idCodeSize() const | |||||||
| size += idIsCnsReloc() ? PADDED_RELOC_SIZE : SizeOfULEB128(emitGetInsSC(this)); | ||||||||
| break; | ||||||||
| } | ||||||||
| case IF_MEMCPY: | ||||||||
| { | ||||||||
| size += idIsCnsReloc() ? PADDED_RELOC_SIZE : SizeOfULEB128(emitGetInsSC(this)); | ||||||||
| size += idIsCnsReloc() ? PADDED_RELOC_SIZE : SizeOfULEB128(emitGetInsSC(this)); | ||||||||
|
||||||||
| size += idIsCnsReloc() ? PADDED_RELOC_SIZE : SizeOfULEB128(emitGetInsSC(this)); | |
| size += idIsCnsReloc() ? PADDED_RELOC_SIZE : SizeOfULEB128(emitGetInsSC(this)); | |
| break; |
Copilot
AI
Jan 29, 2026
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.
Missing break statement causes fall-through to the IF_LOCAL_DECL case. This will result in incorrect output when displaying IF_MEMCPY instructions, as it will also print the local declaration information.
| } | |
| } | |
| break; |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -218,6 +218,10 @@ INST(i64_trunc_sat_f32_u, "i64.trunc_sat_f32_u", 0, IF_OPCODE, 0x05FC) | |||
| INST(i64_trunc_sat_f64_s, "i64.trunc_sat_f64_s", 0, IF_OPCODE, 0x06FC) | ||||
| INST(i64_trunc_sat_f64_u, "i64.trunc_sat_f64_u", 0, IF_OPCODE, 0x07FC) | ||||
|
|
||||
| INST(memory_copy, "memory.copy", 0, IF_MEMCPY, 0x10FC) | ||||
| INST(memory_fill, "memory.fill", 0, IF_ULEB128, 0x11FC) | ||||
|
|
||||
|
|
||||
|
||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -171,7 +171,62 @@ GenTree* Lowering::LowerBinaryArithmetic(GenTreeOp* binOp) | |||||
| // | ||||||
| void Lowering::LowerBlockStore(GenTreeBlk* blkNode) | ||||||
| { | ||||||
| NYI_WASM("LowerBlockStore"); | ||||||
| GenTree* dstAddr = blkNode->Addr(); | ||||||
| GenTree* src = blkNode->Data(); | ||||||
| unsigned size = blkNode->Size(); | ||||||
|
|
||||||
| if (blkNode->OperIsInitBlkOp()) | ||||||
| { | ||||||
| if (src->OperIs(GT_INIT_VAL)) | ||||||
| { | ||||||
| src->SetContained(); | ||||||
| src = src->AsUnOp()->gtGetOp1(); | ||||||
| } | ||||||
|
|
||||||
| if (blkNode->IsZeroingGcPointersOnHeap()) | ||||||
| { | ||||||
| blkNode->gtBlkOpKind = GenTreeBlk::BlkOpKindLoop; | ||||||
| src->SetContained(); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| // memory.fill | ||||||
| } | ||||||
|
Comment on lines
+191
to
+194
|
||||||
| } | ||||||
| else | ||||||
| { | ||||||
| assert(src->OperIs(GT_IND, GT_LCL_VAR, GT_LCL_FLD)); | ||||||
| src->SetContained(); | ||||||
|
|
||||||
| if (src->OperIs(GT_LCL_VAR)) | ||||||
| { | ||||||
| // TODO-1stClassStructs: for now we can't work with STORE_BLOCK source in register. | ||||||
| // TODO-WASM: Is this true for wasm as well? | ||||||
| const unsigned srcLclNum = src->AsLclVar()->GetLclNum(); | ||||||
| comp->lvaSetVarDoNotEnregister(srcLclNum DEBUGARG(DoNotEnregisterReason::BlockOp)); | ||||||
|
||||||
| comp->lvaSetVarDoNotEnregister(srcLclNum DEBUGARG(DoNotEnregisterReason::BlockOp)); | |
| comp->lvaSetVarDoNotEnregister(srcLclNum DEBUGARG(DoNotEnregisterReason::StoreBlkSrc)); |
Copilot
AI
Jan 29, 2026
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.
This code path leaves blkNode->gtBlkOpKind unset (it remains BlkOpKindInvalid). When codegen encounters this node, it will fail because there's no handling for WASM memory.copy instruction yet. Either this should set an appropriate operation kind, or GT_STORE_BLK handling should be added to codegenwasm.cpp before this PR is merged.
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.
The comment should be
<opcode> <memory index> <memory index>to be consistent with other instruction format comments that include the opcode in their description (e.g., ULEB128, SLEB128, MEMARG).