YJIT: Fallback megamorphic super/yield to dynamic dispatch (#8197)
YJIT: Fallback megamorphic super/yield to dynamic dispatch
This commit is contained in:
parent
cc0fca2729
commit
3ad306b4f0
Notes:
git
2023-08-10 18:14:49 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
@ -7226,6 +7226,12 @@ fn gen_invokeblock_specialized(
|
|||||||
return Some(EndBlock);
|
return Some(EndBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to dynamic dispatch if this callsite is megamorphic
|
||||||
|
if asm.ctx.get_chain_depth() as i32 >= SEND_MAX_CHAIN_DEPTH {
|
||||||
|
gen_counter_incr(asm, Counter::invokeblock_megamorphic);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
// Get call info
|
// Get call info
|
||||||
let ci = unsafe { get_call_data_ci(cd) };
|
let ci = unsafe { get_call_data_ci(cd) };
|
||||||
let argc: i32 = unsafe { vm_ci_argc(ci) }.try_into().unwrap();
|
let argc: i32 = unsafe { vm_ci_argc(ci) }.try_into().unwrap();
|
||||||
@ -7389,6 +7395,12 @@ fn gen_invokesuper_specialized(
|
|||||||
return Some(EndBlock);
|
return Some(EndBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to dynamic dispatch if this callsite is megamorphic
|
||||||
|
if asm.ctx.get_chain_depth() as i32 >= SEND_MAX_CHAIN_DEPTH {
|
||||||
|
gen_counter_incr(asm, Counter::invokesuper_megamorphic);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let me = unsafe { rb_vm_frame_method_entry(jit.get_cfp()) };
|
let me = unsafe { rb_vm_frame_method_entry(jit.get_cfp()) };
|
||||||
if me.is_null() {
|
if me.is_null() {
|
||||||
gen_counter_incr(asm, Counter::invokesuper_no_me);
|
gen_counter_incr(asm, Counter::invokesuper_no_me);
|
||||||
@ -7463,7 +7475,14 @@ fn gen_invokesuper_specialized(
|
|||||||
|
|
||||||
let me_as_value = VALUE(me as usize);
|
let me_as_value = VALUE(me as usize);
|
||||||
asm.cmp(ep_me_opnd, me_as_value.into());
|
asm.cmp(ep_me_opnd, me_as_value.into());
|
||||||
asm.jne(Target::side_exit(Counter::guard_invokesuper_me_changed));
|
jit_chain_guard(
|
||||||
|
JCC_JNE,
|
||||||
|
jit,
|
||||||
|
asm,
|
||||||
|
ocb,
|
||||||
|
SEND_MAX_CHAIN_DEPTH,
|
||||||
|
Counter::guard_invokesuper_me_changed,
|
||||||
|
);
|
||||||
|
|
||||||
// gen_send_* currently support the first two branches in vm_caller_setup_arg_block:
|
// gen_send_* currently support the first two branches in vm_caller_setup_arg_block:
|
||||||
// * VM_CALL_ARGS_BLOCKARG
|
// * VM_CALL_ARGS_BLOCKARG
|
||||||
|
@ -277,11 +277,13 @@ make_counters! {
|
|||||||
invokesuper_defined_class_mismatch,
|
invokesuper_defined_class_mismatch,
|
||||||
invokesuper_kw_splat,
|
invokesuper_kw_splat,
|
||||||
invokesuper_kwarg,
|
invokesuper_kwarg,
|
||||||
|
invokesuper_megamorphic,
|
||||||
invokesuper_no_cme,
|
invokesuper_no_cme,
|
||||||
invokesuper_no_me,
|
invokesuper_no_me,
|
||||||
invokesuper_not_iseq_or_cfunc,
|
invokesuper_not_iseq_or_cfunc,
|
||||||
invokesuper_refinement,
|
invokesuper_refinement,
|
||||||
|
|
||||||
|
invokeblock_megamorphic,
|
||||||
invokeblock_none,
|
invokeblock_none,
|
||||||
invokeblock_iseq_arg0_optional,
|
invokeblock_iseq_arg0_optional,
|
||||||
invokeblock_iseq_arg0_has_kw,
|
invokeblock_iseq_arg0_has_kw,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user