Skip to content

Commit d7ad446

Browse files
committed
ZJIT: Count method sends where method lookup fails
1 parent f0702c5 commit d7ad446

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

zjit/src/hir.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ pub enum MethodType {
481481
Optimized,
482482
Missing,
483483
Refined,
484+
Null,
484485
}
485486

486487
impl From<u32> for MethodType {
@@ -1852,6 +1853,9 @@ impl Function {
18521853
// Do method lookup
18531854
let mut cme = unsafe { rb_callable_method_entry(klass, mid) };
18541855
if cme.is_null() {
1856+
if let Insn::SendWithoutBlock { def_type: insn_def_type, .. } = &mut self.insns[insn_id.0] {
1857+
*insn_def_type = Some(MethodType::Null);
1858+
}
18551859
self.push_insn_id(block, insn_id); continue;
18561860
}
18571861
// Load an overloaded cme if applicable. See vm_search_cc().

zjit/src/stats.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ make_counters! {
150150
send_fallback_optimized,
151151
send_fallback_missing,
152152
send_fallback_refined,
153+
send_fallback_null,
153154

154155
// Writes to the VM frame
155156
vm_write_pc_count,
@@ -263,6 +264,7 @@ pub fn send_fallback_counter(def_type: crate::hir::MethodType) -> Counter {
263264
Optimized => send_fallback_optimized,
264265
Missing => send_fallback_missing,
265266
Refined => send_fallback_refined,
267+
Null => send_fallback_null,
266268
}
267269
}
268270

0 commit comments

Comments
 (0)