Actions
Bug #12018
closedTail call optimization is incorrectly applied in Ruby 2.3.0
    Bug #12018:
    Tail call optimization is incorrectly applied in Ruby 2.3.0
  
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-01-25 trunk 53652) [x86_64-linux]
Description
r51903 changed the operand order of send/invokesuper instructions, but the code applying tail call optimization still looks at the second operand, which is now CALL_CACHE.
The following code causes a segmentation fault:
RubyVM::InstructionSequence.compile_option = { tailcall_optimization: true }
def just_yield
  yield
end
eval "just_yield { }"
I attached a patch to fix it.
Files
        
           Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
          Updated by nobu (Nobuyoshi Nakada) almost 10 years ago
          
          
        
        
      
      - Status changed from Open to Closed
Applied in changeset r53658.
compile.c: fix tailcall optimization
- compile.c (iseq_peephole_optimize): don't apply tailcall
 optimization to send/invokesuper instructions with blockiseq.
 This is a follow-up to the changes in r51903; blockiseq is now
 the third operand of send/invokesuper instructions.
 [ruby-core:73413] [Bug #12018]
        
           Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago
          Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago
          
          
        
        
      
      - Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED
        
           Updated by naruse (Yui NARUSE) over 9 years ago
          Updated by naruse (Yui NARUSE) over 9 years ago
          
          
        
        
      
      - Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONE
ruby_2_3 r54401 merged revision(s) 53658.
Actions