aboutsummaryrefslogtreecommitdiff
path: root/src/lj_trace.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/lj_trace.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/lj_trace.c')
-rw-r--r--src/lj_trace.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c
index 0e948e8d..3e2cd0b3 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -343,6 +343,14 @@ void lj_trace_initstate(global_State *g)
343 J->k32[LJ_K32_M2P64] = 0xdf800000; 343 J->k32[LJ_K32_M2P64] = 0xdf800000;
344#endif 344#endif
345#endif 345#endif
346#if LJ_TARGET_PPC || LJ_TARGET_MIPS32
347 J->k32[LJ_K32_VM_EXIT_HANDLER] = (uintptr_t)(void *)lj_vm_exit_handler;
348 J->k32[LJ_K32_VM_EXIT_INTERP] = (uintptr_t)(void *)lj_vm_exit_interp;
349#endif
350#if LJ_TARGET_ARM64 || LJ_TARGET_MIPS64
351 J->k64[LJ_K64_VM_EXIT_HANDLER].u64 = (uintptr_t)lj_ptr_sign((void *)lj_vm_exit_handler, 0);
352 J->k64[LJ_K64_VM_EXIT_INTERP].u64 = (uintptr_t)lj_ptr_sign((void *)lj_vm_exit_interp, 0);
353#endif
346} 354}
347 355
348/* Free everything associated with the JIT compiler state. */ 356/* Free everything associated with the JIT compiler state. */
@@ -637,10 +645,15 @@ static int trace_abort(jit_State *J)
637 J->cur.traceno = 0; 645 J->cur.traceno = 0;
638 } 646 }
639 L->top--; /* Remove error object */ 647 L->top--; /* Remove error object */
640 if (e == LJ_TRERR_DOWNREC) 648 if (e == LJ_TRERR_DOWNREC) {
641 return trace_downrec(J); 649 return trace_downrec(J);
642 else if (e == LJ_TRERR_MCODEAL) 650 } else if (e == LJ_TRERR_MCODEAL) {
651 if (!J->mcarea) { /* Disable JIT compiler if first mcode alloc fails. */
652 J->flags &= ~JIT_F_ON;
653 lj_dispatch_update(J2G(J));
654 }
643 lj_trace_flushall(L); 655 lj_trace_flushall(L);
656 }
644 return 0; 657 return 0;
645} 658}
646 659