@@ -364,7 +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, .. } => {
368+ if let Some ( def_type) = def_type { update_send_fallback_counter ( asm, * def_type) ; }
369+ gen_send_without_block ( jit, asm, * cd, & function. frame_state ( * state) )
370+ }
368371 // Give up SendWithoutBlockDirect for 6+ args since asm.ccall() doesn't support it.
369372 Insn :: SendWithoutBlockDirect { cd, state, args, .. } if args. len ( ) + 1 > C_ARG_OPNDS . len ( ) => // +1 for self
370373 gen_send_without_block ( jit, asm, * cd, & function. frame_state ( * state) ) ,
@@ -1995,6 +1998,24 @@ fn aligned_stack_bytes(num_slots: usize) -> usize {
19951998 num_slots * SIZEOF_VALUE
19961999}
19972000
2001+ fn update_send_fallback_counter ( asm : & mut Assembler , def_type : u32 ) {
2002+ match def_type {
2003+ VM_METHOD_TYPE_ISEQ => { gen_incr_counter ( asm, Counter :: send_fallback_iseq) ; }
2004+ VM_METHOD_TYPE_CFUNC => { gen_incr_counter ( asm, Counter :: send_fallback_cfunc) ; }
2005+ VM_METHOD_TYPE_ATTRSET => { gen_incr_counter ( asm, Counter :: send_fallback_attrset) ; }
2006+ VM_METHOD_TYPE_IVAR => { gen_incr_counter ( asm, Counter :: send_fallback_ivar) ; }
2007+ VM_METHOD_TYPE_BMETHOD => { gen_incr_counter ( asm, Counter :: send_fallback_bmethod) ; }
2008+ VM_METHOD_TYPE_ZSUPER => { gen_incr_counter ( asm, Counter :: send_fallback_zsuper) ; }
2009+ VM_METHOD_TYPE_ALIAS => { gen_incr_counter ( asm, Counter :: send_fallback_alias) ; }
2010+ VM_METHOD_TYPE_UNDEF => { gen_incr_counter ( asm, Counter :: send_fallback_undef) ; }
2011+ VM_METHOD_TYPE_NOTIMPLEMENTED => { gen_incr_counter ( asm, Counter :: send_fallback_not_implemented) ; }
2012+ VM_METHOD_TYPE_OPTIMIZED => { gen_incr_counter ( asm, Counter :: send_fallback_optimized) ; }
2013+ VM_METHOD_TYPE_MISSING => { gen_incr_counter ( asm, Counter :: send_fallback_missing) ; }
2014+ VM_METHOD_TYPE_REFINED => { gen_incr_counter ( asm, Counter :: send_fallback_refined) ; }
2015+ _ => unreachable ! ( "unknown method type: {def_type}" ) ,
2016+ }
2017+ }
2018+
19982019impl Assembler {
19992020 /// Make a C call while marking the start and end positions for IseqCall
20002021 fn ccall_with_iseq_call ( & mut self , fptr : * const u8 , opnds : Vec < Opnd > , iseq_call : & Rc < RefCell < IseqCall > > ) -> Opnd {
0 commit comments