From e1ffafb2855e808fea05e150c28665bb365f1990 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 30 Jan 2023 12:50:08 -0500 Subject: [PATCH] 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. --- yjit/src/codegen.rs | 25 +++++++++---------------- 1 file 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, - 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:");