summaryrefslogtreecommitdiff
path: root/debug_counter.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-01-21 03:33:59 +0900
committerKoichi Sasada <ko1@atdot.net>2021-01-29 16:22:12 +0900
commit1ecda213668644d656eb0d60654737482447dd92 (patch)
tree2231cf25d2215ba1358c21c82e823fcae5203e34 /debug_counter.h
parent9241211538189a58b477bd55b539357617fd42ed (diff)
global call-cache cache table for rb_funcall*
rb_funcall* (rb_funcall(), rb_funcallv(), ...) functions invokes Ruby's method with given receiver. Ruby 2.7 introduced inline method cache with static memory area. However, Ruby 3.0 reimplemented the method cache data structures and the inline cache was removed. Without inline cache, rb_funcall* searched methods everytime. Most of cases per-Class Method Cache (pCMC) will be helped but pCMC requires VM-wide locking and it hurts performance on multi-Ractor execution, especially all Ractors calls methods with rb_funcall*. This patch introduced Global Call-Cache Cache Table (gccct) for rb_funcall*. Call-Cache was introduced from Ruby 3.0 to manage method cache entry atomically and gccct enables method-caching without VM-wide locking. This table solves the performance issue on multi-ractor execution. [Bug #17497] Ruby-level method invocation does not use gccct because it has inline-method-cache and the table size is limited. Basically rb_funcall* is not used frequently, so 1023 entries can be enough. We will revisit the table size if it is not enough.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4129
Diffstat (limited to 'debug_counter.h')
-rw-r--r--debug_counter.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/debug_counter.h b/debug_counter.h
index 6dc66ef988..3c20821db6 100644
--- a/debug_counter.h
+++ b/debug_counter.h
@@ -62,6 +62,9 @@ RB_DEBUG_COUNTER(ccs_not_found) // count for not found corresponding ccs on met
// vm_eval.c
RB_DEBUG_COUNTER(call0_public)
RB_DEBUG_COUNTER(call0_other)
+RB_DEBUG_COUNTER(gccct_hit)
+RB_DEBUG_COUNTER(gccct_miss)
+RB_DEBUG_COUNTER(gccct_null)
// iseq
RB_DEBUG_COUNTER(iseq_num) // number of total created iseq