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

ruby-changes:32657

From: usa <ko1@a...>
Date: Wed, 29 Jan 2014 12:42:54 +0900 (JST)
Subject: [ruby-changes:32657] usa:r44736 (ruby_1_9_3): merge revision(s) 39276: [Backport #7825]

usa	2014-01-29 12:42:50 +0900 (Wed, 29 Jan 2014)

  New Revision: 44736

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

  Log:
    merge revision(s) 39276: [Backport #7825]
    
    * vm.c (rb_thread_mark): mark a working Proc of bmethod
      (a method defined by define_method) even if the method was removed.
      We could not trace working Proc object which represents the body
      of bmethod if the method was removed (alias/undef/overridden).
      Simply, it was mark miss.
      This patch by Kazuki Tsujimoto. [Bug #7825]
      NOTE: We can brush up this marking because we do not need to mark
      `me' on each living control frame. We need to mark `me's
      only if `me' was free'ed. This is future work after Ruby 2.0.0.
    
    * test/ruby/test_method.rb: add a test.

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/test/ruby/test_method.rb
    branches/ruby_1_9_3/version.h
    branches/ruby_1_9_3/vm.c
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 44735)
+++ ruby_1_9_3/ChangeLog	(revision 44736)
@@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Wed Jan 29 12:37:33 2014  Koichi Sasada  <ko1@a...>
+
+	* vm.c (rb_thread_mark): mark a working Proc of bmethod
+	  (a method defined by define_method) even if the method was removed.
+	  We could not trace working Proc object which represents the body
+	  of bmethod if the method was removed (alias/undef/overridden).
+	  Simply, it was mark miss.
+	  This patch by Kazuki Tsujimoto. [Bug #7825]
+
+	  NOTE: We can brush up this marking because we do not need to mark
+	  `me' on each living control frame. We need to mark `me's
+	  only if `me' was free'ed. This is future work after Ruby 2.0.0.
+
+	* test/ruby/test_method.rb: add a test.
+
 Wed Jan 29 12:35:37 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
Index: ruby_1_9_3/vm.c
===================================================================
--- ruby_1_9_3/vm.c	(revision 44735)
+++ ruby_1_9_3/vm.c	(revision 44736)
@@ -1744,7 +1744,11 @@ rb_thread_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/vm.c#L1744
 		if (iseq) {
 		    rb_gc_mark(RUBY_VM_NORMAL_ISEQ_P(iseq) ? iseq->self : (VALUE)iseq);
 		}
-		if (cfp->me) ((rb_method_entry_t *)cfp->me)->mark = 1;
+		if (cfp->me) {
+		    /* TODO: marking `me' can be more sophisticated way */
+		    ((rb_method_entry_t *)cfp->me)->mark = 1;
+		    rb_mark_method_entry(cfp->me);
+		}
 		cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
 	    }
 	}
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44735)
+++ ruby_1_9_3/version.h	(revision 44736)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 490
+#define RUBY_PATCHLEVEL 491
 
 #define RUBY_RELEASE_DATE "2014-01-29"
 #define RUBY_RELEASE_YEAR 2014
Index: ruby_1_9_3/test/ruby/test_method.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_method.rb	(revision 44735)
+++ ruby_1_9_3/test/ruby/test_method.rb	(revision 44736)
@@ -472,4 +472,18 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/test/ruby/test_method.rb#L472
       1000.times {p = Bug6171.new('test'); 10000.times {p.reverse}}
       EOC
   end
+
+  def test_gced_bmethod
+    assert_normal_exit %q{
+      require 'irb'
+      IRB::Irb.module_eval do
+        define_method(:eval_input) do
+          IRB::Irb.module_eval { alias_method :eval_input, :to_s }
+          GC.start
+          Kernel
+        end
+      end
+      IRB.start
+    }, '[Bug #7825]'
+  end
 end

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39276


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

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