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

ruby-changes:39440

From: nagachika <ko1@a...>
Date: Tue, 11 Aug 2015 01:31:30 +0900 (JST)
Subject: [ruby-changes:39440] nagachika:r51521 (ruby_2_2): merge revision(s) 51263, 51264: [Backport #11352]

nagachika	2015-08-11 01:31:18 +0900 (Tue, 11 Aug 2015)

  New Revision: 51521

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

  Log:
    merge revision(s) 51263,51264: [Backport #11352]
    
    * vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
      stack before rewinding the control frame pointer and leaving the
      arguments outside valid region of the value stack.
      [ruby-core:69969] [Bug #11352]
    
    * vm.c (REWIND_CFP): keep the arguments region inside the valid
      value stack.  [ruby-core:69969] [Bug #11352]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/test/ruby/test_literal.rb
    branches/ruby_2_2/version.h
    branches/ruby_2_2/vm.c
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 51520)
+++ ruby_2_2/ChangeLog	(revision 51521)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Tue Aug 11 01:21:49 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* vm.c (m_core_hash_merge_ptr): copy the arguments to the machine
+	  stack before rewinding the control frame pointer and leaving the
+	  arguments outside valid region of the value stack.
+	  [ruby-core:69969] [Bug #11352]
+
+	* vm.c (REWIND_CFP): keep the arguments region inside the valid
+	  value stack.  [ruby-core:69969] [Bug #11352]
+
 Tue Aug 11 01:11:02 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_reverse): reversed string is not a substring,
Index: ruby_2_2/vm.c
===================================================================
--- ruby_2_2/vm.c	(revision 51520)
+++ ruby_2_2/vm.c	(revision 51521)
@@ -2267,7 +2267,11 @@ vm_define_method(rb_thread_t *th, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm.c#L2267
 
 #define REWIND_CFP(expr) do { \
     rb_thread_t *th__ = GET_THREAD(); \
-    th__->cfp++; expr; th__->cfp--; \
+    VALUE *const curr_sp = (th__->cfp++)->sp; \
+    VALUE *const saved_sp = th__->cfp->sp; \
+    th__->cfp->sp = curr_sp; \
+    expr; \
+    (th__->cfp--)->sp = saved_sp; \
 } while (0)
 
 static VALUE
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 51520)
+++ ruby_2_2/version.h	(revision 51521)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-08-11"
-#define RUBY_PATCHLEVEL 153
+#define RUBY_PATCHLEVEL 154
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/test/ruby/test_literal.rb
===================================================================
--- ruby_2_2/test/ruby/test_literal.rb	(revision 51520)
+++ ruby_2_2/test/ruby/test_literal.rb	(revision 51521)
@@ -192,7 +192,9 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_literal.rb#L192
     assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("[#{(1..1_000_000).to_a.join(", ")}]").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
     assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => x"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
     assert_normal_exit %q{GC.disable=true; x = nil; raise if eval("{#{(1..1_000_000).map{|n| "#{n} => #{n}"}.join(', ')}}").size != 1_000_000}, "", timeout: 300, child_env: %[--disable-gems]
+  end
 
+  def test_big_hash_literal
     bug7466 = '[ruby-dev:46658]'
     h = {
       0xFE042 => 0xE5CD,
@@ -327,6 +329,19 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_literal.rb#L329
     }
     k = h.keys
     assert_equal([129, 0xFE331], [k.size, k.last], bug7466)
+
+    code = [
+      "h = {",
+      (1..128).map {|i| "#{i} => 0,"},
+      (129..140).map {|i| "#{i} => [],"},
+      "}",
+    ].join
+    assert_separately([], <<-"end;")
+      GC.stress = true
+      #{code}
+      GC.stress = false
+      assert_equal(140, h.size)
+    end;
   end
 
   def test_range

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51263-51264


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

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