diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2021-03-11 20:24:48 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2021-03-11 20:24:48 +0900 |
commit | de6072a22edbaab3793cf7f976cc9e0118d0df40 (patch) | |
tree | 08c22551519d9c01b02e45c888713dbf6107f855 /vm_callinfo.h | |
parent | 0074ea2d83230e10ab0cd769fff203c13d3c592f (diff) |
merge revision(s) abdc634f64a440afcdc7f23c9757d27aab4db8a9,083c5f08ec4e95c9b75810d46f933928327a5ab3,1ecda213668644d656eb0d60654737482447dd92,813fe4c256f89babebb8ab53821ae5eb6bb138c6: [Backport #17497]
remove unused decl
---
internal/vm.h | 6 ------
vm_args.c | 2 --
2 files changed, 8 deletions(-)
Check stack overflow in recursive glob_helper [Bug #17162]
---
dir.c | 2 ++
internal/vm.h | 1 +
vm_eval.c | 10 ++++++++++
3 files changed, 13 insertions(+)
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.
---
debug_counter.h | 3 +
vm.c | 12 +++
vm_callinfo.h | 12 ---
vm_core.h | 5 +
vm_eval.c | 288 ++++++++++++++++++++++++++++++++++++++++++--------------
vm_insnhelper.c | 11 ++-
vm_method.c | 14 ++-
7 files changed, 255 insertions(+), 90 deletions(-)
opt_equality_by_mid for rb_equal_opt
This patch improves the performance of sequential and parallel
execution of rb_equal() (and rb_eql()).
[Bug #17497]
rb_equal_opt (and rb_eql_opt) does not have own cd and it waste
a time to initialize cd. This patch introduces opt_equality_by_mid()
to check equality without cd.
Furthermore, current master uses "static" cd on rb_equal_opt
(and rb_eql_opt) and it hurts CPU caches on multi-thread execution.
Now they are gone so there are no bottleneck on parallel execution.
---
vm_insnhelper.c | 99 ++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 63 insertions(+), 36 deletions(-)
Diffstat (limited to 'vm_callinfo.h')
-rw-r--r-- | vm_callinfo.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h index 4ee6fa72e6..d846a2cc4d 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -376,18 +376,6 @@ extern const struct rb_callcache *rb_vm_empty_cc(void); /* callcache: mutate */ static inline void -vm_cc_cme_set(const struct rb_callcache *cc, const struct rb_callable_method_entry_struct *cme) -{ - VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); - VM_ASSERT(cc != vm_cc_empty()); - VM_ASSERT(vm_cc_cme(cc) != NULL); - VM_ASSERT(vm_cc_cme(cc)->called_id == cme->called_id); - VM_ASSERT(!vm_cc_markable(cc)); // only used for vm_eval.c - - *((const struct rb_callable_method_entry_struct **)&cc->cme_) = cme; -} - -static inline void vm_cc_call_set(const struct rb_callcache *cc, vm_call_handler call) { VM_ASSERT(IMEMO_TYPE_P(cc, imemo_callcache)); |