Skip to content

Commit 0c01286

Browse files
authored
[clr-interp] Fix emit of bb end var moves (#114267)
This code makes the current stack state match the stack state expected by a bblock that we transition to. The code was accidentally offseting from the current stack pointer, rather than from the base of the stack.
1 parent 819bff1 commit 0c01286

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,16 +402,16 @@ void InterpCompiler::EmitBBEndVarMoves(InterpBasicBlock *pTargetBB)
402402

403403
for (int i = 0; i < pTargetBB->stackHeight; i++)
404404
{
405-
int sVar = m_pStackPointer[i].var;
405+
int sVar = m_pStackBase[i].var;
406406
int dVar = pTargetBB->pStackState[i].var;
407407
if (sVar != dVar)
408408
{
409409
InterpType interpType = m_pVars[sVar].interpType;
410410
int32_t movOp = InterpGetMovForType(interpType, false);
411411

412412
AddIns(movOp);
413-
m_pLastNewIns->SetSVar(m_pStackPointer[i].var);
414-
m_pLastNewIns->SetDVar(pTargetBB->pStackState[i].var);
413+
m_pLastNewIns->SetSVar(sVar);
414+
m_pLastNewIns->SetDVar(dVar);
415415

416416
if (interpType == InterpTypeVT)
417417
{

0 commit comments

Comments
 (0)