summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mjit.h4
-rw-r--r--tool/ruby_vm/views/_mjit_compile_send.erb2
-rw-r--r--vm.c2
-rw-r--r--vm_insnhelper.h8
4 files changed, 7 insertions, 9 deletions
diff --git a/mjit.h b/mjit.h
index eee3a8badb..17148fcdc6 100644
--- a/mjit.h
+++ b/mjit.h
@@ -89,7 +89,7 @@ mjit_target_iseq_p(struct rb_iseq_constant_body *body)
/* Try to execute the current iseq in ec. Use JIT code if it is ready.
If it is not, add ISEQ to the compilation queue and return Qundef. */
static inline VALUE
-mjit_exec(rb_execution_context_t *ec)
+mjit_exec(rb_execution_context_t *ec, int guard_except_p)
{
const rb_iseq_t *iseq;
struct rb_iseq_constant_body *body;
@@ -102,6 +102,8 @@ mjit_exec(rb_execution_context_t *ec)
iseq = ec->cfp->iseq;
body = iseq->body;
total_calls = ++body->total_calls;
+ if (guard_except_p && body->catch_except_p)
+ return Qundef;
func = body->jit_func;
if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) {
diff --git a/tool/ruby_vm/views/_mjit_compile_send.erb b/tool/ruby_vm/views/_mjit_compile_send.erb
index 1c737a1fe3..494a9afa4e 100644
--- a/tool/ruby_vm/views/_mjit_compile_send.erb
+++ b/tool/ruby_vm/views/_mjit_compile_send.erb
@@ -60,7 +60,7 @@
fprintf(f, " v = vm_exec(ec, TRUE);\n");
}
else {
- fprintf(f, " if ((v = mjit_exec(ec)) == Qundef) {\n");
+ fprintf(f, " if ((v = mjit_exec(ec, FALSE)) == Qundef) {\n");
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */
fprintf(f, " v = vm_exec(ec, FALSE);\n");
fprintf(f, " }\n");
diff --git a/vm.c b/vm.c
index da9afe2fc7..0fb6295b6e 100644
--- a/vm.c
+++ b/vm.c
@@ -1806,7 +1806,7 @@ vm_exec(rb_execution_context_t *ec, int mjit_enable_p)
_tag.retval = Qnil;
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
- if (!mjit_enable_p || (result = mjit_exec(ec)) == Qundef) {
+ if (!mjit_enable_p || (result = mjit_exec(ec, FALSE)) == Qundef) {
result = vm_exec_core(ec, initial);
}
goto vm_loop_start; /* fallback to the VM */
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index b5f35df2bd..f63ada001d 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -144,11 +144,7 @@ enum vm_regan_acttype {
the caller frame may have stack values in the local variables and the cancelling
the caller frame will purge them. But directly calling mjit_exec is faster... */
#define EXEC_EC_CFP(val) do { \
- if (ec->cfp->iseq->body->catch_except_p) { \
- VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
- val = vm_exec(ec, TRUE); \
- } \
- else if ((val = mjit_exec(ec)) == Qundef) { \
+ if ((val = mjit_exec(ec, TRUE)) == Qundef) { \
VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
val = vm_exec(ec, FALSE); \
} \
@@ -157,7 +153,7 @@ enum vm_regan_acttype {
/* When calling from VM, longjmp in the callee won't purge any JIT-ed caller frames.
So it's safe to directly call mjit_exec. */
#define EXEC_EC_CFP(val) do { \
- if ((val = mjit_exec(ec)) == Qundef) { \
+ if ((val = mjit_exec(ec, FALSE)) == Qundef) { \
RESTORE_REGS(); \
NEXT_INSN(); \
} \