Skip to content

Commit 84e5e27

Browse files
authored
[Wasm RyuJit] Use local's register type when loading it's value (dotnet#127619)
Fixes an assert loading some register-sized struct locals.
1 parent 013ca46 commit 84e5e27

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/coreclr/jit/codegenwasm.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,8 +2302,9 @@ void CodeGen::genCodeForLclVar(GenTreeLclVar* tree)
23022302
else
23032303
{
23042304
assert(genIsValidReg(varDsc->GetRegNum()));
2305-
unsigned wasmLclIndex = WasmRegToIndex(varDsc->GetRegNum());
2306-
GetEmitter()->emitIns_I(INS_local_get, emitTypeSize(tree), wasmLclIndex);
2305+
var_types type = varDsc->GetRegisterType(tree);
2306+
unsigned wasmLclIndex = WasmRegToIndex(varDsc->GetRegNum());
2307+
GetEmitter()->emitIns_I(INS_local_get, emitTypeSize(type), wasmLclIndex);
23072308
// In this case, the resulting tree type may be different from the local var type where the value originates,
23082309
// and so we need an explicit conversion since we can't "load"
23092310
// the value with a different type like we can if the value is on the shadow stack.

0 commit comments

Comments
 (0)