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.
This commit is contained in:
Alan Wu 2023-01-30 12:50:08 -05:00 committed by GitHub
parent cb06006213
commit e1ffafb285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-01-30 17:50:30 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View File

@ -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:");