Skip to content

Commit 39b13e5

Browse files
authored
YJIT: End send fallback blocks (#10539)
1 parent 646a008 commit 39b13e5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

yjit/src/codegen.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8223,6 +8223,7 @@ fn gen_struct_aset(
82238223
fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
82248224
jit: &mut JITState,
82258225
asm: &mut Assembler,
8226+
ocb: &mut OutlinedCb,
82268227
cd: *const rb_call_data,
82278228
sp_pops: usize,
82288229
vm_sendish: F,
@@ -8262,7 +8263,10 @@ fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
82628263
gen_counter_incr(asm, Counter::num_send_dynamic);
82638264

82648265
jit_perf_symbol_pop!(jit, asm, PerfMap::Codegen);
8265-
Some(KeepCompiling)
8266+
8267+
// End the current block for invalidationg and sharing the same successor
8268+
jump_to_next_insn(jit, asm, ocb);
8269+
Some(EndBlock)
82668270
}
82678271

82688272
fn gen_send_general(
@@ -8776,7 +8780,7 @@ fn gen_opt_send_without_block(
87768780
}
87778781

87788782
// Otherwise, fallback to dynamic dispatch using the interpreter's implementation of send
8779-
gen_send_dynamic(jit, asm, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
8783+
gen_send_dynamic(jit, asm, ocb, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
87808784
extern "C" {
87818785
fn rb_vm_opt_send_without_block(ec: EcPtr, cfp: CfpPtr, cd: VALUE) -> VALUE;
87828786
}
@@ -8801,7 +8805,7 @@ fn gen_send(
88018805

88028806
// Otherwise, fallback to dynamic dispatch using the interpreter's implementation of send
88038807
let blockiseq = jit.get_arg(1).as_iseq();
8804-
gen_send_dynamic(jit, asm, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
8808+
gen_send_dynamic(jit, asm, ocb, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
88058809
extern "C" {
88068810
fn rb_vm_send(ec: EcPtr, cfp: CfpPtr, cd: VALUE, blockiseq: IseqPtr) -> VALUE;
88078811
}
@@ -8824,7 +8828,7 @@ fn gen_invokeblock(
88248828
}
88258829

88268830
// Otherwise, fallback to dynamic dispatch using the interpreter's implementation of send
8827-
gen_send_dynamic(jit, asm, cd, unsafe { rb_yjit_invokeblock_sp_pops((*cd).ci) }, |asm| {
8831+
gen_send_dynamic(jit, asm, ocb, cd, unsafe { rb_yjit_invokeblock_sp_pops((*cd).ci) }, |asm| {
88288832
extern "C" {
88298833
fn rb_vm_invokeblock(ec: EcPtr, cfp: CfpPtr, cd: VALUE) -> VALUE;
88308834
}
@@ -8984,7 +8988,7 @@ fn gen_invokesuper(
89848988

89858989
// Otherwise, fallback to dynamic dispatch using the interpreter's implementation of send
89868990
let blockiseq = jit.get_arg(1).as_iseq();
8987-
gen_send_dynamic(jit, asm, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
8991+
gen_send_dynamic(jit, asm, ocb, cd, unsafe { rb_yjit_sendish_sp_pops((*cd).ci) }, |asm| {
89888992
extern "C" {
89898993
fn rb_vm_invokesuper(ec: EcPtr, cfp: CfpPtr, cd: VALUE, blockiseq: IseqPtr) -> VALUE;
89908994
}

0 commit comments

Comments
 (0)