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

ruby-changes:42561

From: naruse <ko1@a...>
Date: Mon, 18 Apr 2016 16:56:43 +0900 (JST)
Subject: [ruby-changes:42561] naruse:r54635 (ruby_2_3): merge revision(s) 54628: [Backport #12296]

naruse	2016-04-18 17:53:20 +0900 (Mon, 18 Apr 2016)

  New Revision: 54635

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

  Log:
    merge revision(s) 54628: [Backport #12296]
    
    * compile.c (iseq_peephole_optimize): should not replace the
      current target INSN, not to follow the replaced dangling link in
      the caller.  [ruby-core:74993] [Bug #11816]

  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/compile.c
===================================================================
--- ruby_2_3/compile.c	(revision 54634)
+++ ruby_2_3/compile.c	(revision 54635)
@@ -841,6 +841,7 @@ INSERT_ELEM_PREV(LINK_ELEMENT *elem1, LI https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L841
     }
 }
 
+#if 0
 /*
  * elemX, elem1, elemY => elemX, elem2, elemY
  */
@@ -856,6 +857,7 @@ REPLACE_ELEM(LINK_ELEMENT *elem1, LINK_E https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L857
 	elem1->next->prev = elem2;
     }
 }
+#endif
 
 static void
 REMOVE_ELEM(LINK_ELEMENT *elem)
@@ -2032,15 +2034,13 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L2034
 	     * LABEL:
 	     *  leave
 	     */
-	    INSN *eiobj = new_insn_core(iseq, iobj->line_no, BIN(leave),
-					diobj->operand_size, diobj->operands);
 	    INSN *popiobj = new_insn_core(iseq, iobj->line_no,
 					  BIN(pop), 0, 0);
 	    /* replace */
 	    unref_destination(iobj);
-	    REPLACE_ELEM((LINK_ELEMENT *)iobj, (LINK_ELEMENT *)eiobj);
-	    INSERT_ELEM_NEXT((LINK_ELEMENT *)eiobj, (LINK_ELEMENT *)popiobj);
-	    iobj = eiobj;
+	    iobj->insn_id = BIN(leave);
+	    iobj->operand_size = 0;
+	    INSERT_ELEM_NEXT(&iobj->link, &popiobj->link);
 	    goto again;
 	}
 	/*
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54634)
+++ ruby_2_3/version.h	(revision 54635)
@@ -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-04-18"
-#define RUBY_PATCHLEVEL 90
+#define RUBY_PATCHLEVEL 91
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_3/test/ruby/test_optimization.rb
===================================================================
--- ruby_2_3/test/ruby/test_optimization.rb	(revision 54634)
+++ ruby_2_3/test/ruby/test_optimization.rb	(revision 54635)
@@ -390,4 +390,9 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_optimization.rb#L390
              end
     assert_nil result, '[ruby-dev:49423] [Bug #11804]'
   end
+
+  def test_nil_safe_conditional_assign
+    bug11816 = '[ruby-core:74993] [Bug #11816]'
+    assert_ruby_status([], 'nil&.foo &&= false', bug11816)
+  end
 end
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54634)
+++ ruby_2_3/ChangeLog	(revision 54635)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Mon Apr 18 17:27:30 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (iseq_peephole_optimize): should not replace the
+	  current target INSN, not to follow the replaced dangling link in
+	  the caller.  [ruby-core:74993] [Bug #11816]
+
 Mon Apr 18 17:18:25 2016  cremno phobia  <cremno@m...>
 
 	* cont.c (fiber_initialize_machine_stack_context): fix wrong

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


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

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