summaryrefslogtreecommitdiff
path: root/vm_exec.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm_exec.h')
-rw-r--r--vm_exec.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/vm_exec.h b/vm_exec.h
index c3b7d4e488..ecf8df3c7d 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -68,10 +68,10 @@ error !
#define INSN_ENTRY_SIG(insn) \
if (0) { \
ruby_debug_printf("exec: %s@(%"PRIdPTRDIFF", %"PRIdPTRDIFF")@%s:%u\n", #insn, \
- (reg_pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded), \
- (reg_cfp->pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded), \
- RSTRING_PTR(rb_iseq_path(reg_cfp->iseq)), \
- rb_iseq_line_no(reg_cfp->iseq, reg_pc - ISEQ_BODY(reg_cfp->iseq)->iseq_encoded)); \
+ (reg_pc - ISEQ_BODY(CFP_ISEQ(reg_cfp))->iseq_encoded), \
+ (reg_cfp->pc - ISEQ_BODY(CFP_ISEQ(reg_cfp))->iseq_encoded), \
+ RSTRING_PTR(rb_iseq_path(CFP_ISEQ(reg_cfp))), \
+ rb_iseq_line_no(CFP_ISEQ(reg_cfp), reg_pc - ISEQ_BODY(CFP_ISEQ(reg_cfp))->iseq_encoded)); \
}
#define INSN_DISPATCH_SIG(insn)
@@ -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)