diff options
author | Mike Pall <mike> | 2017-03-08 23:01:47 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2017-03-08 23:01:47 +0100 |
commit | d62459fc3949baca5ee1c1919feb4f4979bb09c6 (patch) | |
tree | dc2e347fb2dcc34fa46919993998f7cb8a645bbc | |
parent | 4e308361bf730ef3d288db5b71489ecf442f738c (diff) | |
download | luajit-d62459fc3949baca5ee1c1919feb4f4979bb09c6.tar.gz luajit-d62459fc3949baca5ee1c1919feb4f4979bb09c6.tar.bz2 luajit-d62459fc3949baca5ee1c1919feb4f4979bb09c6.zip |
Limit mcode alloc probing, depending on the available pool size.
Contributed by Alexey Kopytov.
-rw-r--r-- | src/lj_mcode.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) | |||
230 | /* First try a contiguous area below the last one. */ | 230 | /* First try a contiguous area below the last one. */ |
231 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; | 231 | uintptr_t hint = J->mcarea ? (uintptr_t)J->mcarea - sz : 0; |
232 | int i; | 232 | 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++) { | ||
234 | if (mcode_validptr(hint)) { | 235 | if (mcode_validptr(hint)) { |
235 | void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN); | 236 | void *p = mcode_alloc_at(J, hint, sz, MCPROT_GEN); |
236 | 237 | ||