Skip to content

Commit d62459f

Browse files
author
Mike Pall
committed
Limit mcode alloc probing, depending on the available pool size.
Contributed by Alexey Kopytov.
1 parent 4e30836 commit d62459f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lj_mcode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ static void *mcode_alloc(jit_State *J, size_t sz)
230230
/* First try a contiguous area below the last one. */
231231
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
232232
int i;
233-
for (i = 0; i < 32; i++) { /* 32 attempts ought to be enough ... */
233+
/* Limit probing iterations, depending on the available pool size. */
234+
for (i = 0; i < LJ_TARGET_JUMPRANGE; i++) {
234235
if (mcode_validptr(hint)) {
235236
void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN);
236237

0 commit comments

Comments
 (0)