|
@@ -206,6 +206,7 @@ static void *mcode_alloc(jit_State *J, size_t sz)
|
|
{
|
|
{
|
|
/* Target an address in the static assembler code (64K aligned).
|
|
/* Target an address in the static assembler code (64K aligned).
|
|
** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB.
|
|
** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB.
|
|
|
|
+ ** Use half the jump range so every address in the range can reach any other.
|
|
*/
|
|
*/
|
|
#if LJ_TARGET_MIPS
|
|
#if LJ_TARGET_MIPS
|
|
/* Use the middle of the 256MB-aligned region. */
|
|
/* Use the middle of the 256MB-aligned region. */
|
|
@@ -214,7 +215,7 @@ static void *mcode_alloc(jit_State *J, size_t sz)
|
|
#else
|
|
#else
|
|
uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff;
|
|
uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff;
|
|
#endif
|
|
#endif
|
|
- const uintptr_t range = (1u << LJ_TARGET_JUMPRANGE) - (1u << 21);
|
|
|
|
|
|
+ const uintptr_t range = (1u << (LJ_TARGET_JUMPRANGE-1)) - (1u << 21);
|
|
/* First try a contiguous area below the last one. */
|
|
/* First try a contiguous area below the last one. */
|
|
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
|
|
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
|
|
int i;
|
|
int i;
|