diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-10-01 16:45:14 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-10-03 15:24:09 +0900 |
commit | 3ffd98c5cd040a4081617b3bc6f9062237937b9b (patch) | |
tree | f2193b04d532ba36bf7c751d66475bc39e637b3f /vm_insnhelper.c | |
parent | 84fc1de5125a6f7c61609bf153f0359b3da55d8d (diff) | |
download | bundler-3ffd98c5cd040a4081617b3bc6f9062237937b9b.tar.gz |
add debug counters for vm_search_method_slowpath()
Implemented fine-grained inspection of cache misshits. Handy for
counting the reasons why an inline method cache was evicted.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 127c8c3f9e..f9c825c272 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1386,12 +1386,15 @@ static inline vm_call_handler calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb_callable_method_entry_t *me) { if (UNLIKELY(!me)) { + RB_DEBUG_COUNTER_INC(mc_miss_by_nome); return vm_call_general; /* vm_call_method_nome() situation */ } else if (LIKELY(cc->me != me)) { + RB_DEBUG_COUNTER_INC(mc_miss_by_distinct); return vm_call_general; /* normal cases */ } else if (UNLIKELY(cc->def != me->def)) { + RB_DEBUG_COUNTER_INC(mc_miss_by_refine); return vm_call_general; /* cc->me was refined elsewhere */ } /* "Calling a formerly-public method, which is now privatised, with an @@ -1400,9 +1403,11 @@ calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb * Calling a private method without specifying a receiver is also safe. */ else if ((METHOD_ENTRY_VISI(cc->me) != METHOD_VISI_PUBLIC) && !(ci->flag & VM_CALL_FCALL)) { + RB_DEBUG_COUNTER_INC(mc_miss_by_visi); return vm_call_general; } else { + RB_DEBUG_COUNTER_INC(mc_miss_spurious); return cc->call; } } |