summaryrefslogtreecommitdiff
path: root/vm_exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_exec.h')
-rw-r--r--vm_exec.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/vm_exec.h b/vm_exec.h
index 152410a6a7..641ace4eaf 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -167,7 +167,7 @@ default: \
// Run the interpreter from the JIT
#define VM_EXEC(ec, val) do { \
- if (val == Qundef) { \
+ if (UNDEF_P(val)) { \
VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
val = vm_exec(ec); \
} \
@@ -175,11 +175,22 @@ default: \
// Run the JIT from the interpreter
#define JIT_EXEC(ec, val) do { \
- rb_jit_func_t func; \
- if (val == Qundef && (func = jit_compile(ec))) { \
- val = func(ec, ec->cfp); \
- RESTORE_REGS(); /* fix cfp for tailcall */ \
- if (ec->tag->state) THROW_EXCEPTION(val); \
+ /* don't run tailcalls since that breaks FINISH */ \
+ if (UNDEF_P(val) && GET_CFP() != ec->cfp) { \
+ rb_zjit_func_t zjit_entry; \
+ if (rb_yjit_enabled_p) { \
+ rb_jit_func_t func = yjit_compile(ec); \
+ if (func) { \
+ val = func(ec, ec->cfp); \
+ if (ec->tag->state) THROW_EXCEPTION(val); \
+ } \
+ } \
+ else if ((zjit_entry = (rb_zjit_func_t)rb_zjit_entry)) { \
+ rb_jit_func_t func = zjit_compile(ec); \
+ if (func) { \
+ val = zjit_entry(ec, ec->cfp, func); \
+ } \
+ } \
} \
} while (0)