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

ruby-changes:39520

From: usa <ko1@a...>
Date: Mon, 17 Aug 2015 16:47:37 +0900 (JST)
Subject: [ruby-changes:39520] usa:r51601 (ruby_2_1): merge revision(s) 51263, 51264: [Backport #11352]

usa	2015-08-17 16:47:27 +0900 (Mon, 17 Aug 2015)

  New Revision: 51601

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

  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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/test/ruby/test_literal.rb
    branches/ruby_2_1/version.h
    branches/ruby_2_1/vm.c
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 51600)
+++ ruby_2_1/ChangeLog	(revision 51601)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Aug 17 16:46:28 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]
+
 Mon Aug 17 16:44:01 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_reverse): reversed string is not a substring,
Index: ruby_2_1/vm.c
===================================================================
--- ruby_2_1/vm.c	(revision 51600)
+++ ruby_2_1/vm.c	(revision 51601)
@@ -2269,7 +2269,11 @@ vm_define_method(rb_thread_t *th, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm.c#L2269
 
 #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_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 51600)
+++ ruby_2_1/version.h	(revision 51601)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.7"
 #define RUBY_RELEASE_DATE "2015-08-17"
-#define RUBY_PATCHLEVEL 384
+#define RUBY_PATCHLEVEL 385
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_1/test/ruby/test_literal.rb
===================================================================
--- ruby_2_1/test/ruby/test_literal.rb	(revision 51600)
+++ ruby_2_1/test/ruby/test_literal.rb	(revision 51601)
@@ -193,7 +193,9 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_literal.rb#L193
     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,
@@ -328,6 +330,19 @@ class TestRubyLiteral < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_literal.rb#L330
     }
     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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51263-51264


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

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