Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,9 @@ int32_t* InterpCompiler::EmitCodeIns(int32_t *ip, InterpInst *ins, TArray<Reloc*
if (ilOffset < (uint32_t)m_ILCodeSizeFromILHeader)
{
uint32_t nativeOffset = ConvertOffset(ins->nativeOffset);
if ((m_ILToNativeMapSize == 0) || (m_pILToNativeMap[m_ILToNativeMapSize - 1].ilOffset != ilOffset))
// Only emit mapping entries at IL offsets where the evaluation stack is empty
if ((ins->flags & INTERP_INST_FLAG_EMPTY_IL_STACK) &&
((m_ILToNativeMapSize == 0) || (m_pILToNativeMap[m_ILToNativeMapSize - 1].ilOffset != ilOffset)))
{
// This code assumes that instructions for the same IL offset are emitted in a single run without
// any other IL offsets in between and that they don't repeat again after the run ends.
Expand All @@ -1076,7 +1078,7 @@ int32_t* InterpCompiler::EmitCodeIns(int32_t *ip, InterpInst *ins, TArray<Reloc*

m_pILToNativeMap[m_ILToNativeMapSize].ilOffset = ilOffset;
m_pILToNativeMap[m_ILToNativeMapSize].nativeOffset = nativeOffset;
m_pILToNativeMap[m_ILToNativeMapSize].source = (ins->flags & INTERP_INST_FLAG_EMPTY_IL_STACK) ? ICorDebugInfo::STACK_EMPTY : ICorDebugInfo::SOURCE_TYPE_INVALID;
m_pILToNativeMap[m_ILToNativeMapSize].source = ICorDebugInfo::STACK_EMPTY;
m_ILToNativeMapSize++;
}
}
Expand Down Expand Up @@ -1120,6 +1122,14 @@ int32_t *InterpCompiler::EmitBBCode(int32_t *ip, InterpBasicBlock *bb, TArray<Re
if (InterpOpIsEmitNop(ins->opcode))
{
ins->nativeOffset = (int32_t)(ip - m_pMethodCode);
if (m_corJitFlags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_DEBUG_CODE))
{
// Emit a debug sequence point so that eliminated IL instructions
// still occupy a bytecode slot. This ensures return addresses after
// calls land within the call's native offset range rather than on
// the next statement boundary.
*ip++ = INTOP_DEBUG_SEQ_POINT;
Comment thread
tommcdon marked this conversation as resolved.
}
continue;
}

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/vm/eetwain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,7 @@ static void VirtualUnwindInterpreterCallFrame(TADDR sp, T_CONTEXT *pContext)
pFrame = pFrame->pParent;
if (pFrame != NULL)
{
// The parent frame's IP points past the call instruction (the resumption point).
SetIP(pContext, (TADDR)pFrame->ip);
SetSP(pContext, dac_cast<TADDR>(pFrame));
SetFP(pContext, (TADDR)pFrame->pStack);
Expand Down
Loading