From f1a67c33ae3a5c3cae5d4323b198575c14d69dde Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Fri, 4 Apr 2025 19:10:49 +0300 Subject: [PATCH] [clr-interp] Fix emit of bb end var moves 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. --- src/coreclr/interpreter/compiler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index 769a1cdc2a055e..d76e8134a94c0d 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -402,7 +402,7 @@ void InterpCompiler::EmitBBEndVarMoves(InterpBasicBlock *pTargetBB) for (int i = 0; i < pTargetBB->stackHeight; i++) { - int sVar = m_pStackPointer[i].var; + int sVar = m_pStackBase[i].var; int dVar = pTargetBB->pStackState[i].var; if (sVar != dVar) { @@ -410,8 +410,8 @@ void InterpCompiler::EmitBBEndVarMoves(InterpBasicBlock *pTargetBB) int32_t movOp = InterpGetMovForType(interpType, false); AddIns(movOp); - m_pLastNewIns->SetSVar(m_pStackPointer[i].var); - m_pLastNewIns->SetDVar(pTargetBB->pStackState[i].var); + m_pLastNewIns->SetSVar(sVar); + m_pLastNewIns->SetDVar(dVar); if (interpType == InterpTypeVT) {