ruby-changes:42327
From: naruse <ko1@a...>
Date: Tue, 29 Mar 2016 22:25:08 +0900 (JST)
Subject: [ruby-changes:42327] naruse:r54401 (ruby_2_3): merge revision(s) 53658: [Backport #12018]
naruse 2016-03-29 22:25:02 +0900 (Tue, 29 Mar 2016) New Revision: 54401 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54401 Log: merge revision(s) 53658: [Backport #12018] * 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] Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/compile.c branches/ruby_2_3/test/ruby/test_optimization.rb branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 54400) +++ ruby_2_3/ChangeLog (revision 54401) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Tue Mar 29 22:08:36 2016 Kazuki Yamaguchi <k@r...> + + * 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] + Tue Mar 29 21:22:22 2016 Nobuyoshi Nakada <nobu@r...> * parse.y (xstring): reset heredoc indent after dedenting, Index: ruby_2_3/compile.c =================================================================== --- ruby_2_3/compile.c (revision 54400) +++ ruby_2_3/compile.c (revision 54401) @@ -2228,8 +2228,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L2228 if (piobj) { struct rb_call_info *ci = (struct rb_call_info *)piobj->operands[0]; - rb_iseq_t *blockiseq = (rb_iseq_t *)piobj->operands[1]; - if (blockiseq == 0) { + if (piobj->insn_id == BIN(send) || piobj->insn_id == BIN(invokesuper)) { + if (piobj->operands[2] == 0) { /* no blockiseq */ + ci->flag |= VM_CALL_TAILCALL; + } + } + else { ci->flag |= VM_CALL_TAILCALL; } } Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 54400) +++ ruby_2_3/version.h (revision 54401) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.0" #define RUBY_RELEASE_DATE "2016-03-29" -#define RUBY_PATCHLEVEL 49 +#define RUBY_PATCHLEVEL 50 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_3/test/ruby/test_optimization.rb =================================================================== --- ruby_2_3/test/ruby/test_optimization.rb (revision 54400) +++ ruby_2_3/test/ruby/test_optimization.rb (revision 54401) @@ -275,6 +275,22 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_optimization.rb#L275 assert_equal(123, delay { 123 }.call, bug6901) end + def just_yield + yield + end + + def test_tailcall_inhibited_by_block + assert_separately([], <<~'end;') + def just_yield + yield + end + iseq = RubyVM::InstructionSequence + result = iseq.compile("just_yield {:ok}", __FILE__, __FILE__, __LINE__, + tailcall_optimization: true).eval + assert_equal(:ok, result) + end; + end + class Bug10557 def [](_) block_given? Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r53658 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/