Skip to content
  • nagachika's avatar
    c660aaf4
    merge revision(s) aeddc193: [Backport #19316] · c660aaf4
    nagachika authored
    	YJIT: Save PC and SP before calling leaf builtins (#7090)
    
    	Previously, we did not update `cfp->sp` before calling the C function of
    	ISEQs marked with `Primitive.attr! "inline"` (leaf builtins). This
    	caused the GC to miss temporary values on the stack in case the function
    	allocates and triggers a GC run. Right now, there is only a few leaf
    	builtins in numeric.rb on Integer methods such as `Integer#~`. Since
    	these methods only allocate when operating on big numbers, we missed
    	this issue.
    
    	Fix by saving PC and SP before calling the functions -- our usual
    	protocol for calling C functions that may allocate on the GC heap.
    
    	[Bug #19316]
    	---
    	 test/ruby/test_yjit.rb | 16 ++++++++++++++++
    	 yjit/src/codegen.rs    |  4 ++++
    	 2 files changed, 20 insertions(+)
    c660aaf4
    merge revision(s) aeddc193: [Backport #19316]
    nagachika authored
    	YJIT: Save PC and SP before calling leaf builtins (#7090)
    
    	Previously, we did not update `cfp->sp` before calling the C function of
    	ISEQs marked with `Primitive.attr! "inline"` (leaf builtins). This
    	caused the GC to miss temporary values on the stack in case the function
    	allocates and triggers a GC run. Right now, there is only a few leaf
    	builtins in numeric.rb on Integer methods such as `Integer#~`. Since
    	these methods only allocate when operating on big numbers, we missed
    	this issue.
    
    	Fix by saving PC and SP before calling the functions -- our usual
    	protocol for calling C functions that may allocate on the GC heap.
    
    	[Bug #19316]
    	---
    	 test/ruby/test_yjit.rb | 16 ++++++++++++++++
    	 yjit/src/codegen.rs    |  4 ++++
    	 2 files changed, 20 insertions(+)
Loading