mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix overly restrictive range calculation in mcode allocation.
Contributed by Alexey Kopytov.
This commit is contained in:
parent
ff648369aa
commit
4e308361bf
@ -239,11 +239,11 @@ static void *mcode_alloc(jit_State *J, size_t sz)
|
|||||||
return p;
|
return p;
|
||||||
if (p) mcode_free(J, p, sz); /* Free badly placed area. */
|
if (p) mcode_free(J, p, sz); /* Free badly placed area. */
|
||||||
}
|
}
|
||||||
/* Next try probing pseudo-random addresses. */
|
/* Next try probing 64K-aligned pseudo-random addresses. */
|
||||||
do {
|
do {
|
||||||
hint = (0x78fb ^ LJ_PRNG_BITS(J, 15)) << 16; /* 64K aligned. */
|
hint = LJ_PRNG_BITS(J, LJ_TARGET_JUMPRANGE-16) << 16;
|
||||||
} while (!(hint + sz < range));
|
} while (!(hint + sz < range+range));
|
||||||
hint = target + hint - (range>>1);
|
hint = target + hint - range;
|
||||||
}
|
}
|
||||||
lj_trace_err(J, LJ_TRERR_MCODEAL); /* Give up. OS probably ignores hints? */
|
lj_trace_err(J, LJ_TRERR_MCODEAL); /* Give up. OS probably ignores hints? */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user