diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-12-14 17:56:34 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-12-14 17:56:34 +0900 |
commit | da3be76cb017c188d1a99d8aa14d13c15d93f9d1 (patch) | |
tree | 1e5b3b22eebb0adce5799eb39e48339c786e3eca /vm_insnhelper.c | |
parent | aacd2295d0f2c982641229e159ff179462d83a36 (diff) |
add debug counters to survey the IMC miss
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 5e77b7fbf2..9cade36fad 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1684,8 +1684,27 @@ rb_vm_search_method_slowpath(VALUE cd_owner, struct rb_call_data *cd, VALUE klas { RB_VM_LOCK_ENTER(); { +#if USE_DEBUG_COUNTER + const struct rb_callcache *old_cc = cd->cc; +#endif const struct rb_callcache *cc = vm_search_cc(klass, cd->ci); +#if USE_DEBUG_COUNTER + if (old_cc == &vm_empty_cc) { + // empty + RB_DEBUG_COUNTER_INC(mc_inline_miss_empty); + } + else if (old_cc == cd->cc) { + RB_DEBUG_COUNTER_INC(mc_inline_miss_same_cc); + } + else if (vm_cc_cme(old_cc) == vm_cc_cme(cc)) { + RB_DEBUG_COUNTER_INC(mc_inline_miss_same_cme); + } + else { + RB_DEBUG_COUNTER_INC(mc_inline_miss_diff); + } +#endif + VM_ASSERT(cc); VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); |