[前][次][番号順一覧][スレッド一覧]

ruby-changes:43706

From: nagachika <ko1@a...>
Date: Sat, 30 Jul 2016 12:32:02 +0900 (JST)
Subject: [ruby-changes:43706] nagachika:r55779 (ruby_2_3): merge revision(s) 55605: [Backport #12565]

nagachika	2016-07-30 12:31:58 +0900 (Sat, 30 Jul 2016)

  New Revision: 55779

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55779

  Log:
    merge revision(s) 55605: [Backport #12565]
    
    * vm_args.c (vm_caller_setup_arg_block): disable symbol block
      argument optimization when tail call optimization is enabled,
      in order to avoid SEGV.  [ruby-core:76288] [Bug #12565]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/test/ruby/test_optimization.rb
    branches/ruby_2_3/version.h
    branches/ruby_2_3/vm_args.c
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 55778)
+++ ruby_2_3/version.h	(revision 55779)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
 #define RUBY_RELEASE_DATE "2016-07-30"
-#define RUBY_PATCHLEVEL 141
+#define RUBY_PATCHLEVEL 142
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 7
Index: ruby_2_3/vm_args.c
===================================================================
--- ruby_2_3/vm_args.c	(revision 55778)
+++ ruby_2_3/vm_args.c	(revision 55779)
@@ -780,7 +780,8 @@ vm_caller_setup_arg_block(const rb_threa https://github.com/ruby/ruby/blob/trunk/ruby_2_3/vm_args.c#L780
 	if (NIL_P(proc)) {
 	    calling->blockptr = NULL;
 	}
-	else if (SYMBOL_P(proc) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
+	else if (LIKELY(!(ci->flag & VM_CALL_TAILCALL)) && SYMBOL_P(proc) &&
+		 rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
 	    calling->blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp);
 	    calling->blockptr->iseq = (rb_iseq_t *)proc;
 	    calling->blockptr->proc = proc;
Index: ruby_2_3/test/ruby/test_optimization.rb
===================================================================
--- ruby_2_3/test/ruby/test_optimization.rb	(revision 55778)
+++ ruby_2_3/test/ruby/test_optimization.rb	(revision 55779)
@@ -319,6 +319,21 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_optimization.rb#L319
     assert_equal("should be rescued", result.message, bug12082)
   end
 
+  def test_tailcall_symbol_block_arg
+    bug12565 = '[ruby-core:46065]'
+    tailcall(<<-EOF)
+      def apply_one_and_two(&block)
+        yield(1, 2)
+      end
+
+      def add_one_and_two
+        apply_one_and_two(&:+)
+      end
+    EOF
+    assert_equal(3, add_one_and_two,
+                 message(bug12565) {disasm(:add_one_and_two)})
+  end
+
   class Bug10557
     def [](_)
       block_given?
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 55778)
+++ ruby_2_3/ChangeLog	(revision 55779)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sat Jul 30 12:23:29 2016  Shugo Maeda  <shugo@r...>
+
+	* vm_args.c (vm_caller_setup_arg_block): disable symbol block
+	  argument optimization when tail call optimization is enabled,
+	  in order to avoid SEGV.  [ruby-core:76288] [Bug #12565]
+
 Sat Jul 30 12:10:51 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* proc.c (passed_block): convert passed block symbol to proc.

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55605


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]