aboutsummaryrefslogtreecommitdiff
path: root/src/lib_jit.c
diff options
context:
space:
mode:
authorMike Pall <mike>2025-11-06 00:42:02 +0100
committerMike Pall <mike>2025-11-06 00:42:02 +0100
commit68354f444728ef99bb51bb4d86e8f1b40853a898 (patch)
tree463fbbf061588513d07f675c579cc69f2aa19eaa /src/lib_jit.c
parent3c7b158b799405545775f7ec52e17019fcf6ace8 (diff)
downloadluajit-68354f444728ef99bb51bb4d86e8f1b40853a898.tar.gz
luajit-68354f444728ef99bb51bb4d86e8f1b40853a898.tar.bz2
luajit-68354f444728ef99bb51bb4d86e8f1b40853a898.zip
Allow mcode allocations outside of the jump range to the support code.
Thank you for your patience. #285
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r--src/lib_jit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index fd8e585b..1b74d957 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -479,12 +479,21 @@ static int jitopt_param(jit_State *J, const char *str)
479 size_t len = *(const uint8_t *)lst; 479 size_t len = *(const uint8_t *)lst;
480 lj_assertJ(len != 0, "bad JIT_P_STRING"); 480 lj_assertJ(len != 0, "bad JIT_P_STRING");
481 if (strncmp(str, lst+1, len) == 0 && str[len] == '=') { 481 if (strncmp(str, lst+1, len) == 0 && str[len] == '=') {
482 int32_t n = 0; 482 uint32_t n = 0;
483 const char *p = &str[len+1]; 483 const char *p = &str[len+1];
484 while (*p >= '0' && *p <= '9') 484 while (*p >= '0' && *p <= '9')
485 n = n*10 + (*p++ - '0'); 485 n = n*10 + (*p++ - '0');
486 if (*p) return 0; /* Malformed number. */ 486 if (*p || (int32_t)n < 0) return 0; /* Malformed number. */
487 J->param[i] = n; 487 if (i == JIT_P_sizemcode) { /* Adjust to required range here. */
488#if LJ_TARGET_JUMPRANGE
489 uint32_t maxkb = ((1 << (LJ_TARGET_JUMPRANGE - 10)) - 64);
490#else
491 uint32_t maxkb = ((1 << (31 - 10)) - 64);
492#endif
493 n = (n + (LJ_PAGESIZE >> 10) - 1) & ~((LJ_PAGESIZE >> 10) - 1);
494 if (n > maxkb) n = maxkb;
495 }
496 J->param[i] = (int32_t)n;
488 if (i == JIT_P_hotloop) 497 if (i == JIT_P_hotloop)
489 lj_dispatch_init_hotcount(J2G(J)); 498 lj_dispatch_init_hotcount(J2G(J));
490 return 1; /* Ok. */ 499 return 1; /* Ok. */