summaryrefslogtreecommitdiff
path: root/yjit/src
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-01-30 12:50:08 -0500
committerGitHub <noreply@github.com>2023-01-30 12:50:08 -0500
commite1ffafb2855e808fea05e150c28665bb365f1990 (patch)
tree107f98cddfcf77c1d28a1f33aa8ace529dae4615 /yjit/src
parentcb060062137ed73313cf6c175e968aabd7bfa243 (diff)
YJIT: Inline return address callback (#7198)
This makes it so that the generator and the output code read in the same order. I think it reads better this way.
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'yjit/src')
-rw-r--r--yjit/src/codegen.rs25
1 files changed, 9 insertions, 16 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 6da3b1fc68..8fa6b37d93 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -4872,21 +4872,6 @@ fn gen_send_cfunc(
EndBlock
}
-fn gen_return_branch(
- asm: &mut Assembler,
- target0: CodePtr,
- _target1: Option<CodePtr>,
- shape: BranchShape,
-) {
- match shape {
- BranchShape::Next0 | BranchShape::Next1 => unreachable!(),
- BranchShape::Default => {
- asm.comment("update cfp->jit_return");
- asm.mov(Opnd::mem(64, CFP, RUBY_OFFSET_CFP_JIT_RETURN), Opnd::const_ptr(target0.raw_ptr()));
- }
- }
-}
-
/// Pushes arguments from an array to the stack that are passed with a splat (i.e. *args)
/// It optimistically compiles to a static size that is the exact number of arguments
/// needed for the function.
@@ -5609,7 +5594,15 @@ fn gen_send_iseq(
&return_ctx,
None,
None,
- gen_return_branch,
+ |asm, target0, _target1, shape| {
+ match shape {
+ BranchShape::Default => {
+ asm.comment("update cfp->jit_return");
+ asm.mov(Opnd::mem(64, CFP, RUBY_OFFSET_CFP_JIT_RETURN), Opnd::const_ptr(target0.raw_ptr()));
+ }
+ _ => unreachable!()
+ }
+ },
);
//print_str(cb, "calling Ruby func:");