diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-18 08:53:20 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-18 08:53:20 +0000 |
commit | 4989a071351199957f6879f842534badd15ba2b6 (patch) | |
tree | 294171d8004a44674d4824b450409bcf891fe1cb | |
parent | 892deeb55b0cdb3c58ffa96cd6b9fef87c822648 (diff) |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | compile.c | 10 | ||||
-rw-r--r-- | test/ruby/test_optimization.rb | 5 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,9 @@ +Mon Apr 18 17:27:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@mail.ru> * cont.c (fiber_initialize_machine_stack_context): fix wrong @@ -841,6 +841,7 @@ INSERT_ELEM_PREV(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2) } } +#if 0 /* * elemX, elem1, elemY => elemX, elem2, elemY */ @@ -856,6 +857,7 @@ REPLACE_ELEM(LINK_ELEMENT *elem1, LINK_ELEMENT *elem2) elem1->next->prev = elem2; } } +#endif static void REMOVE_ELEM(LINK_ELEMENT *elem) @@ -2032,15 +2034,13 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal * 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; } /* diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 8804931bca..17c8a3210b 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -390,4 +390,9 @@ class TestRubyOptimization < Test::Unit::TestCase 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 @@ -1,6 +1,6 @@ #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 |