Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
YJIT: End send fallback blocks
  • Loading branch information
k0kubun committed Apr 16, 2024
commit 17566f8dfb720c02eac9e16e97c3d843c94f9a38
14 changes: 9 additions & 5 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8223,6 +8223,7 @@ fn gen_struct_aset(
fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
jit: &mut JITState,
asm: &mut Assembler,
ocb: &mut OutlinedCb,
cd: *const rb_call_data,
sp_pops: usize,
vm_sendish: F,
Expand Down Expand Up @@ -8262,7 +8263,10 @@ fn gen_send_dynamic<F: Fn(&mut Assembler) -> Opnd>(
gen_counter_incr(asm, Counter::num_send_dynamic);

jit_perf_symbol_pop!(jit, asm, PerfMap::Codegen);
Some(KeepCompiling)

// End the current block for invalidationg and sharing the same successor
jump_to_next_insn(jit, asm, ocb);
Some(EndBlock)
}

fn gen_send_general(
Expand Down Expand Up @@ -8776,7 +8780,7 @@ fn gen_opt_send_without_block(
}

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

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

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

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