mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
MIPS: Use precise search for exit jump patching.
Contributed by Djordje Kovacevic and Stefan Pejic.
This commit is contained in:
parent
630ff3196a
commit
7381b62035
@ -1933,7 +1933,11 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target)
|
||||
MCode tjump = MIPSI_J|(((uintptr_t)target>>2)&0x03ffffffu);
|
||||
for (p++; p < pe; p++) {
|
||||
if (*p == exitload) { /* Look for load of exit number. */
|
||||
if (((p[-1] ^ (px-p)) & 0xffffu) == 0) { /* Look for exitstub branch. */
|
||||
/* Look for exitstub branch. Yes, this covers all used branch variants. */
|
||||
if (((p[-1] ^ (px-p)) & 0xffffu) == 0 &&
|
||||
((p[-1] & 0xf0000000u) == MIPSI_BEQ ||
|
||||
(p[-1] & 0xfc1e0000u) == MIPSI_BLTZ ||
|
||||
(p[-1] & 0xffe00000u) == MIPSI_BC1F)) {
|
||||
ptrdiff_t delta = target - p;
|
||||
if (((delta + 0x8000) >> 16) == 0) { /* Patch in-range branch. */
|
||||
patchbranch:
|
||||
|
Loading…
Reference in New Issue
Block a user