Skip to content

Commit

Permalink
Limit mcode alloc probing, depending on the available pool size.
Browse files Browse the repository at this point in the history
Contributed by Alexey Kopytov.
  • Loading branch information
Mike Pall committed Mar 8, 2017
1 parent 4e30836 commit d62459f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lj_mcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ static void *mcode_alloc(jit_State *J, size_t sz)
/* First try a contiguous area below the last one. */
uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0;
int i;
for (i = 0; i < 32; i++) { /* 32 attempts ought to be enough ... */
/* Limit probing iterations, depending on the available pool size. */
for (i = 0; i < LJ_TARGET_JUMPRANGE; i++) {
if (mcode_validptr(hint)) {
void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN);

Expand Down

0 comments on commit d62459f

Please sign in to comment.