summaryrefslogtreecommitdiff
path: root/yjit.h
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-07-07 11:15:40 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:37 -0400
commitd0174d99c6fcbeae2d5cdaa34908b9ac117bb9c3 (patch)
treeb36938eeb96470dcdf339a59a872fd37687badc8 /yjit.h
parentb70383fbea8d4acc49eceed24c83d87637412ff4 (diff)
downloadruby-d0174d99c6fcbeae2d5cdaa34908b9ac117bb9c3.tar.gz
Always use `ret` to return to the interpreter
Always using `ret` to return to the interpreter means that we never have to check the VM_FRAME_FLAG_FINISH flag. In the case that we return `Qundef`, the interpreter will execute the cfp. We can take advantage of this by setting the PC to the instruction we can't handle, and let the interpreter pick up the ball from there. If we return a value other than Qundef, the interpreter will take that value as the "return value" from the JIT and push that to the SP of the caller The leave instruction puts the return value on the top of the calling frame's stack. YJIT does the same thing for leave instructions. However, when we're returning back to the interpreter, the leave instruction _should not_ put the return value on the top of the stack, but put it in RAX and use RET. This commit pops the last value from the stack pointer and puts it in RAX so that the interpreter is happy with SP.
Diffstat (limited to 'yjit.h')
-rw-r--r--yjit.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/yjit.h b/yjit.h
index cb41e76ecf..0e7a7b6c9b 100644
--- a/yjit.h
+++ b/yjit.h
@@ -62,7 +62,7 @@ void rb_yjit_cme_invalidate(VALUE cme);
void rb_yjit_collect_vm_usage_insn(int insn);
void rb_yjit_collect_binding_alloc(void);
void rb_yjit_collect_binding_set(void);
-void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec);
+bool rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec);
void rb_yjit_init(struct rb_yjit_options *options);
void rb_yjit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_operators bop);
void rb_yjit_constant_state_changed(void);