diff options
| -rw-r--r-- | src/lj_mcode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_mcode.c b/src/lj_mcode.c index 5f7582c4..cb79e8cd 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c | |||
| @@ -206,6 +206,7 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
| 206 | { | 206 | { |
| 207 | /* Target an address in the static assembler code (64K aligned). | 207 | /* Target an address in the static assembler code (64K aligned). |
| 208 | ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. | 208 | ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. |
| 209 | ** Use half the jump range so every address in the range can reach any other. | ||
| 209 | */ | 210 | */ |
| 210 | #if LJ_TARGET_MIPS | 211 | #if LJ_TARGET_MIPS |
| 211 | /* Use the middle of the 256MB-aligned region. */ | 212 | /* Use the middle of the 256MB-aligned region. */ |
| @@ -214,7 +215,7 @@ static void *mcode_alloc(jit_State *J, size_t sz) | |||
| 214 | #else | 215 | #else |
| 215 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; | 216 | uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; |
| 216 | #endif | 217 | #endif |
| 217 | const uintptr_t range = (1u << LJ_TARGET_JUMPRANGE) - (1u << 21); | 218 | const uintptr_t range = (1u << (LJ_TARGET_JUMPRANGE-1)) - (1u << 21); |
| 218 | /* First try a contiguous area below the last one. */ | 219 | /* First try a contiguous area below the last one. */ |
| 219 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; | 220 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; |
| 220 | int i; | 221 | int i; |
