From: Mike Pall Date: Wed, 8 Mar 2017 22:01:47 +0000 (+0100) Subject: Limit mcode alloc probing, depending on the available pool size. X-Git-Tag: v2.0.5~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d62459fc3949baca5ee1c1919feb4f4979bb09c6;p=thirdparty%2FLuaJIT.git Limit mcode alloc probing, depending on the available pool size. Contributed by Alexey Kopytov. --- diff --git a/src/lj_mcode.c b/src/lj_mcode.c index f0cf22ca..bb7cf96b 100644 --- a/src/lj_mcode.c +++ b/src/lj_mcode.c @@ -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);