Skip to content
  • NARUSE, Yui's avatar
    de6072a2
    merge revision(s)... · de6072a2
    NARUSE, Yui authored
    merge revision(s) abdc634f,083c5f08,1ecda213,813fe4c2: [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(-)
    de6072a2
    merge revision(s)...
    NARUSE, Yui authored
    merge revision(s) abdc634f,083c5f08,1ecda213,813fe4c2: [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(-)
Loading