summaryrefslogtreecommitdiff
path: root/yjit_iface.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_iface.h
parentb70383fbea8d4acc49eceed24c83d87637412ff4 (diff)
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_iface.h')
-rw-r--r--yjit_iface.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/yjit_iface.h b/yjit_iface.h
index 30bee18ed1..4f63cdb974 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -46,7 +46,6 @@ YJIT_DECLARE_COUNTERS(
send_se_cf_overflow,
send_se_protected_check_failed,
- leave_se_finish_frame,
leave_se_interrupt,
leave_interp_return,