Skip to content

Commit

Permalink
Fix emitSplit logic
Browse files Browse the repository at this point in the history
  • Loading branch information
amanasifkhalid committed Sep 9, 2024
1 parent 67e5768 commit d40e42f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3071,8 +3071,21 @@ void emitter::emitSplit(emitLocation* startLoc,

} // end for loop

splitIfNecessary();
assert(curSize < UW_MAX_FRAGMENT_SIZE_BYTES);
if ((igLastCandidate != nullptr) && (curSize == candidateSize))
{
// TODO: This scenario may be possible (but very unlikely) when using the default fragment size.
// Fixing this would likely require padding out the last fragment to not be zero-sized, and doing the split.
// For now, assume this only occurs under stress modes, or when using DOTNET_JitSplitFunctionSize.
assert(maxSplitSize != UW_MAX_FRAGMENT_SIZE_BYTES);
JITDUMP("emitSplit: can't split at last candidate IG%02u because it would create a zero-sized fragment\n",
igLastCandidate->igNum);
}
else
{
splitIfNecessary();
}

assert((curSize > 0) && (curSize < UW_MAX_FRAGMENT_SIZE_BYTES));
}

/*****************************************************************************
Expand Down

0 comments on commit d40e42f

Please sign in to comment.