diff options
author | Mike Pall <mike> | 2017-06-07 19:16:22 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2017-06-07 19:16:22 +0200 |
commit | 7381b620358c2561e8690149f1d25828fdad6675 (patch) | |
tree | 7533b2e16dd57122ad59894b6d7f1cc58a1f3928 | |
parent | 630ff3196a06353c6a7ccd1e9ac3958f4a8ca13c (diff) | |
download | luajit-7381b620358c2561e8690149f1d25828fdad6675.tar.gz luajit-7381b620358c2561e8690149f1d25828fdad6675.tar.bz2 luajit-7381b620358c2561e8690149f1d25828fdad6675.zip |
MIPS: Use precise search for exit jump patching.
Contributed by Djordje Kovacevic and Stefan Pejic.
-rw-r--r-- | src/lj_asm_mips.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h index 03270cca..d0a1ca51 100644 --- a/src/lj_asm_mips.h +++ b/src/lj_asm_mips.h | |||
@@ -1933,7 +1933,11 @@ void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, MCode *target) | |||
1933 | MCode tjump = MIPSI_J|(((uintptr_t)target>>2)&0x03ffffffu); | 1933 | MCode tjump = MIPSI_J|(((uintptr_t)target>>2)&0x03ffffffu); |
1934 | for (p++; p < pe; p++) { | 1934 | for (p++; p < pe; p++) { |
1935 | if (*p == exitload) { /* Look for load of exit number. */ | 1935 | if (*p == exitload) { /* Look for load of exit number. */ |
1936 | if (((p[-1] ^ (px-p)) & 0xffffu) == 0) { /* Look for exitstub branch. */ | 1936 | /* Look for exitstub branch. Yes, this covers all used branch variants. */ |
1937 | if (((p[-1] ^ (px-p)) & 0xffffu) == 0 && | ||
1938 | ((p[-1] & 0xf0000000u) == MIPSI_BEQ || | ||
1939 | (p[-1] & 0xfc1e0000u) == MIPSI_BLTZ || | ||
1940 | (p[-1] & 0xffe00000u) == MIPSI_BC1F)) { | ||
1937 | ptrdiff_t delta = target - p; | 1941 | ptrdiff_t delta = target - p; |
1938 | if (((delta + 0x8000) >> 16) == 0) { /* Patch in-range branch. */ | 1942 | if (((delta + 0x8000) >> 16) == 0) { /* Patch in-range branch. */ |
1939 | patchbranch: | 1943 | patchbranch: |