summaryrefslogtreecommitdiff
path: root/vm_exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_exec.h')
-rw-r--r--vm_exec.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/vm_exec.h b/vm_exec.h
index c3b7d4e488..641ace4eaf 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -175,11 +175,22 @@ default: \
// Run the JIT from the interpreter
#define JIT_EXEC(ec, val) do { \
- rb_jit_func_t func; \
/* don't run tailcalls since that breaks FINISH */ \
- if (UNDEF_P(val) && GET_CFP() != ec->cfp && (func = jit_compile(ec))) { \
- val = func(ec, ec->cfp); \
- if (ec->tag->state) THROW_EXCEPTION(val); \
+ 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)