@@ -13,10 +13,10 @@ use crate::invariants::{track_bop_assumption, track_cme_assumption, track_no_ep_
1313use crate :: gc:: { append_gc_offsets, get_or_create_iseq_payload, get_or_create_iseq_payload_ptr, IseqPayload , IseqStatus } ;
1414use crate :: state:: ZJITState ;
1515use crate :: stats:: { exit_counter_for_compile_error, incr_counter, incr_counter_by, CompileError } ;
16- use crate :: stats:: { counter_ptr, with_time_stat, Counter , Counter :: { compile_time_ns, exit_compile_error} } ;
16+ use crate :: stats:: { counter_ptr, with_time_stat, Counter , send_fallback_counter , Counter :: { compile_time_ns, exit_compile_error} } ;
1717use crate :: { asm:: CodeBlock , cruby:: * , options:: debug, virtualmem:: CodePtr } ;
1818use crate :: backend:: lir:: { self , asm_comment, asm_ccall, Assembler , Opnd , Target , CFP , C_ARG_OPNDS , C_RET_OPND , EC , NATIVE_STACK_PTR , NATIVE_BASE_PTR , SCRATCH_OPND , SP } ;
19- use crate :: hir:: { iseq_to_hir, Block , BlockId , BranchEdge , Invariant , RangeType , SideExitReason , SideExitReason :: * , SpecialObjectType , SpecialBackrefSymbol , SELF_PARAM_IDX } ;
19+ use crate :: hir:: { iseq_to_hir, Block , BlockId , BranchEdge , Invariant , RangeType , SideExitReason , SideExitReason :: * , MethodType , SpecialObjectType , SpecialBackrefSymbol , SELF_PARAM_IDX } ;
2020use crate :: hir:: { Const , FrameState , Function , Insn , InsnId } ;
2121use crate :: hir_type:: { types, Type } ;
2222use crate :: options:: get_option;
@@ -364,10 +364,10 @@ fn gen_insn(cb: &mut CodeBlock, jit: &mut JITState, asm: &mut Assembler, functio
364364 Insn :: IfTrue { val, target } => no_output ! ( gen_if_true( jit, asm, opnd!( val) , target) ) ,
365365 Insn :: IfFalse { val, target } => no_output ! ( gen_if_false( jit, asm, opnd!( val) , target) ) ,
366366 & Insn :: Send { cd, blockiseq, state, .. } => gen_send ( jit, asm, cd, blockiseq, & function. frame_state ( state) ) ,
367- Insn :: SendWithoutBlock { cd, state, .. } => gen_send_without_block ( jit, asm, * cd, & function. frame_state ( * state) ) ,
367+ Insn :: SendWithoutBlock { cd, state, def_type , .. } => gen_send_without_block ( jit, asm, * cd, * def_type , & function. frame_state ( * state) ) ,
368368 // Give up SendWithoutBlockDirect for 6+ args since asm.ccall() doesn't support it.
369369 Insn :: SendWithoutBlockDirect { cd, state, args, .. } if args. len ( ) + 1 > C_ARG_OPNDS . len ( ) => // +1 for self
370- gen_send_without_block ( jit, asm, * cd, & function. frame_state ( * state) ) ,
370+ gen_send_without_block ( jit, asm, * cd, None , & function. frame_state ( * state) ) ,
371371 Insn :: SendWithoutBlockDirect { cme, iseq, recv, args, state, .. } => gen_send_without_block_direct ( cb, jit, asm, * cme, * iseq, opnd ! ( recv) , opnds ! ( args) , & function. frame_state ( * state) ) ,
372372 & Insn :: InvokeSuper { cd, blockiseq, state, .. } => gen_invokesuper ( jit, asm, cd, blockiseq, & function. frame_state ( state) ) ,
373373 Insn :: InvokeBlock { cd, state, .. } => gen_invokeblock ( jit, asm, * cd, & function. frame_state ( * state) ) ,
@@ -999,10 +999,16 @@ fn gen_send_without_block(
999999 jit : & mut JITState ,
10001000 asm : & mut Assembler ,
10011001 cd : * const rb_call_data ,
1002+ def_type : Option < MethodType > ,
10021003 state : & FrameState ,
10031004) -> lir:: Opnd {
10041005 gen_incr_counter ( asm, Counter :: dynamic_send_count) ;
10051006 gen_incr_counter ( asm, Counter :: dynamic_send_type_send_without_block) ;
1007+
1008+ if let Some ( def_type) = def_type {
1009+ gen_incr_counter ( asm, send_fallback_counter ( def_type) ) ;
1010+ }
1011+
10061012 gen_prepare_non_leaf_call ( jit, asm, state) ;
10071013 asm_comment ! ( asm, "call #{} with dynamic dispatch" , ruby_call_method_name( cd) ) ;
10081014 unsafe extern "C" {
0 commit comments