ruby-changes:50411
From: naruse <ko1@a...>
Date: Thu, 22 Feb 2018 20:01:19 +0900 (JST)
Subject: [ruby-changes:50411] naruse:r62527 (ruby_2_5): merge revision(s) 62333: [Backport #14459]
naruse 2018-02-22 20:01:13 +0900 (Thu, 22 Feb 2018) New Revision: 62527 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62527 Log: merge revision(s) 62333: [Backport #14459] compile.c: popped hash * compile.c (compile_array): skip creating new hash if preceeding elements are popped all. [ruby-core:85486] [Bug #14459] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/compile.c branches/ruby_2_5/test/ruby/test_optimization.rb branches/ruby_2_5/version.h Index: ruby_2_5/compile.c =================================================================== --- ruby_2_5/compile.c (revision 62526) +++ ruby_2_5/compile.c (revision 62527) @@ -3649,14 +3649,20 @@ compile_array(rb_iseq_t *iseq, LINK_ANCH https://github.com/ruby/ruby/blob/trunk/ruby_2_5/compile.c#L3649 case COMPILE_ARRAY_TYPE_HASH: if (i > 0) { if (first) { - ADD_INSN1(anchor, line, newhash, INT2FIX(i)); + if (!popped) { + ADD_INSN1(anchor, line, newhash, INT2FIX(i)); + } APPEND_LIST(ret, anchor); } else { - ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); - ADD_INSN(ret, line, swap); + if (!popped) { + ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE)); + ADD_INSN(ret, line, swap); + } APPEND_LIST(ret, anchor); - ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(i + 1)); + if (!popped) { + ADD_SEND(ret, line, id_core_hash_merge_ptr, INT2FIX(i + 1)); + } } } if (kw) { Index: ruby_2_5/test/ruby/test_optimization.rb =================================================================== --- ruby_2_5/test/ruby/test_optimization.rb (revision 62526) +++ ruby_2_5/test/ruby/test_optimization.rb (revision 62527) @@ -707,6 +707,11 @@ class TestRubyOptimization < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ruby/test_optimization.rb#L707 bug = '[ruby-core:84340] [Bug #14201]' eval("{**(bug = nil; {})};42") assert_nil(bug) + + bug = '[ruby-core:85486] [Bug #14459]' + h = {} + assert_equal(bug, eval('{ok: 42, **h}; bug')) + assert_equal(:ok, eval('{ok: bug = :ok, **h}; bug')) end def test_overwritten_blockparam Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 62526) +++ ruby_2_5/version.h (revision 62527) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.0" -#define RUBY_RELEASE_DATE "2018-02-21" -#define RUBY_PATCHLEVEL 29 +#define RUBY_RELEASE_DATE "2018-02-22" +#define RUBY_PATCHLEVEL 30 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 21 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 62526) +++ ruby_2_5 (revision 62527) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r62333 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/