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

ruby-changes:56684

From: nagachika <ko1@a...>
Date: Sun, 28 Jul 2019 23:17:20 +0900 (JST)
Subject: [ruby-changes:56684] nagachika: 4e12051fe8 (ruby_2_6): merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]

https://git.ruby-lang.org/ruby.git/commit/?id=4e12051fe8

From 4e12051fe885f93eb5ce8eb114f6ee944b417035 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sun, 28 Jul 2019 14:16:53 +0000
Subject: merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport
 #15906]

	compile.c: Partially revert r63870 which caused wrong optimization

	[Bug #15906]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/compile.c b/compile.c
index a23e786..d6e6c8f 100644
--- a/compile.c
+++ b/compile.c
@@ -2775,7 +2775,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal https://github.com/ruby/ruby/blob/trunk/compile.c#L2775
 	    ELEM_INSERT_NEXT(&dniobj->link, &pop->link);
 	    goto again;
 	}
-	else if ((piobj = (INSN *)get_prev_insn(iobj)) != 0 &&
+       else if (IS_INSN(iobj->link.prev) &&
+                 (piobj = (INSN *)iobj->link.prev) &&
 		 (IS_INSN_ID(piobj, branchif) ||
 		  IS_INSN_ID(piobj, branchunless))) {
 	    INSN *pdiobj = (INSN *)get_destination_insn(piobj);
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb
index 5609602..bc3eacc 100644
--- a/test/ruby/test_optimization.rb
+++ b/test/ruby/test_optimization.rb
@@ -795,6 +795,21 @@ class TestRubyOptimization < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_optimization.rb#L795
     assert_equal(:ok, x.bug(:ok))
   end
 
+  def test_jump_elimination_with_optimized_out_block_2
+    x = Object.new
+    def x.bug
+      a = "aaa"
+      ok = :NG
+      if a == "bbb" || a == "ccc" then
+        a = a
+      else
+        ok = :ok
+      end
+      ok
+    end
+    assert_equal(:ok, x.bug)
+  end
+
   def test_peephole_jump_after_newarray
     i = 0
     %w(1) || 2 while (i += 1) < 100
diff --git a/version.h b/version.h
index a49de18..6d22451 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.3"
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 68
+#define RUBY_PATCHLEVEL 69
 
 #define RUBY_RELEASE_YEAR 2019
 #define RUBY_RELEASE_MONTH 7
-- 
cgit v0.10.2


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

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