Browse Source

Merge branch 'master' into v2.1

Mike Pall 12 years ago
parent
commit
48912a2dea
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/lj_mcode.c

+ 2 - 1
src/lj_mcode.c

@@ -206,6 +206,7 @@ static void *mcode_alloc(jit_State *J, size_t sz)
 {
   /* Target an address in the static assembler code (64K aligned).
   ** 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
   /* Use the middle of the 256MB-aligned region. */
@@ -214,7 +215,7 @@ static void *mcode_alloc(jit_State *J, size_t sz)
 #else
   uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff;
 #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. */
   uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
   int i;