aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2013-04-05 20:22:41 +0200
committerMike Pall <mike>2013-04-05 20:22:41 +0200
commitb5bbacdc17815bbf1c6353322a7eb85cd3994399 (patch)
treec69e0fe82e7b43603f92a8c305d8f6317d3f891e /src
parent389822d606045a953bd30e14ebc50ff97bce8a59 (diff)
downloadluajit-b5bbacdc17815bbf1c6353322a7eb85cd3994399.tar.gz
luajit-b5bbacdc17815bbf1c6353322a7eb85cd3994399.tar.bz2
luajit-b5bbacdc17815bbf1c6353322a7eb85cd3994399.zip
Fix jump-range constrained mcode allocation.
Diffstat (limited to 'src')
-rw-r--r--src/lj_mcode.c3
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;