Skip to content
  • U.Nakamura's avatar
    2698b68a
    merge revision(s) 537183cd: [Backport #19577] · 2698b68a
    U.Nakamura authored
    	Fix write barrier order for `klass` to `cme` edge
    
    	Previously, the following crashes with
    	`CFLAGS=-DRGENGC_CHECK_MODE=2 -DRUBY_DEBUG=1 -fno-inline`:
    
    	    $ ./miniruby -e 'GC.stress = true; Marshal.dump({})'
    
    	It crashes with a write barrier (WB) miss assertion on an edge from the
    	`Hash` class object to a newly allocated negative method entry.
    
    	This is due to usages of vm_ccs_create() running the WB too early,
    	before the method entry is inserted into the cc table, so before the
    	reference edge is established. The insertion can trigger GC and promote
    	the class object, so running the WB after the insertion is necessary.
    	Move the insertion into vm_ccs_create() and run the WB after the
    	insertion.
    
    	Discovered on CI:
    	http://ci.rvm.jp/results/trunk-asserts@ruby-sp2-docker/4391770
    	---
    	 vm_eval.c       |  3 +--
    	 vm_insnhelper.c | 10 ++++++----
    	 vm_method.c     |  3 +--
    	 3 files changed, 8 insertions(+), 8 deletions(-)
    2698b68a
    merge revision(s) 537183cd: [Backport #19577]
    U.Nakamura authored
    	Fix write barrier order for `klass` to `cme` edge
    
    	Previously, the following crashes with
    	`CFLAGS=-DRGENGC_CHECK_MODE=2 -DRUBY_DEBUG=1 -fno-inline`:
    
    	    $ ./miniruby -e 'GC.stress = true; Marshal.dump({})'
    
    	It crashes with a write barrier (WB) miss assertion on an edge from the
    	`Hash` class object to a newly allocated negative method entry.
    
    	This is due to usages of vm_ccs_create() running the WB too early,
    	before the method entry is inserted into the cc table, so before the
    	reference edge is established. The insertion can trigger GC and promote
    	the class object, so running the WB after the insertion is necessary.
    	Move the insertion into vm_ccs_create() and run the WB after the
    	insertion.
    
    	Discovered on CI:
    	http://ci.rvm.jp/results/trunk-asserts@ruby-sp2-docker/4391770
    	---
    	 vm_eval.c       |  3 +--
    	 vm_insnhelper.c | 10 ++++++----
    	 vm_method.c     |  3 +--
    	 3 files changed, 8 insertions(+), 8 deletions(-)
Loading