Skip to content

Commit 58409f2

Browse files
AndyAyersMSCopilot
andcommitted
Keep fgVarNeedsExplicitZeroInit in sync with WASM block-init rule
Address PR review feedback: genCheckUseBlockInit now uses block-init on WASM whenever there are any init slots, so fgVarNeedsExplicitZeroInit should mirror that and skip the per-target size threshold for WASM. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2438ad3 commit 58409f2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/coreclr/jit/compiler.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,11 @@ bool Compiler::fgVarNeedsExplicitZeroInit(unsigned varNum, bool bbInALoop, bool
43544354
// Below conditions guarantee block initialization, which will initialize
43554355
// all struct fields. If the logic for block initialization in CodeGen::genCheckUseBlockInit()
43564356
// changes, these conditions need to be updated.
4357+
#ifdef TARGET_WASM
4358+
// On WASM the prolog always uses a single memory.fill to zero any
4359+
// locals that need initialization, regardless of size.
4360+
return false;
4361+
#else // !TARGET_WASM
43574362
unsigned stackHomeSize = lvaLclStackHomeSize(varNum);
43584363
#ifdef TARGET_64BIT
43594364
#if defined(TARGET_AMD64)
@@ -4369,6 +4374,7 @@ bool Compiler::fgVarNeedsExplicitZeroInit(unsigned varNum, bool bbInALoop, bool
43694374
{
43704375
return false;
43714376
}
4377+
#endif // !TARGET_WASM
43724378
}
43734379

43744380
return !info.compInitMem || (varDsc->lvIsTemp && !varDsc->HasGCPtr());

0 commit comments

Comments
 (0)