[Loader] Patch red-zone sites from the previous instruction when every indirect branch is resolved
This commit is contained in:
parent
28b2f5709d
commit
ee9660d81d
|
|
@ -310,7 +310,10 @@ internal static class GuestRedZonePatcher
|
|||
canBorrowFollowingInstructions,
|
||||
out span,
|
||||
out refusal);
|
||||
if (!forward)
|
||||
var backward = !forward &&
|
||||
canBorrowFollowingInstructions &&
|
||||
TryBuildEnclosingPatchSpan(decoded, instructionIndex, branchTargets, out span);
|
||||
if (!forward && !backward)
|
||||
{
|
||||
unrelocatableSites++;
|
||||
refusalCounts[(int)refusal]++;
|
||||
|
|
@ -335,10 +338,13 @@ internal static class GuestRedZonePatcher
|
|||
shaInstructionCount += span.Instructions.Count(static instruction => ShaInstructionRewrite.CanRewrite(instruction));
|
||||
}
|
||||
|
||||
if (!backward)
|
||||
{
|
||||
instructionIndex += span.Instructions.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = new PatchResult
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue