Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ void InterpCompiler::PatchRelocations(TArray<Reloc*> *relocs)
for (int32_t i = 0; i < size; i++)
{
Reloc *reloc = relocs->Get(i);
if (reloc->pTargetBB->nativeOffset < 0)
BADCODE("jump with invalid offset");

int32_t offset = reloc->pTargetBB->nativeOffset - reloc->offset;
int32_t *pSlot = NULL;

Expand Down Expand Up @@ -2111,14 +2114,15 @@ void InterpCompiler::EmitBranch(InterpOpcode opcode, int32_t ilOffset)
{
int32_t target = (int32_t)(m_ip - m_pILCode) + ilOffset;
if (target < 0 || target >= m_ILCodeSize)
assert(0);
BADCODE("code jumps to outer space");

// Backwards branch, emit safepoint
if (ilOffset < 0)
AddIns(INTOP_SAFEPOINT);

InterpBasicBlock *pTargetBB = m_ppOffsetToBB[target];
assert(pTargetBB != NULL);
if (pTargetBB == NULL)
BADCODE("code jumps to invalid offset");

EmitBranchToBB(opcode, pTargetBB);
}
Expand Down
Loading