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

ruby-changes:32155

From: ko1 <ko1@a...>
Date: Mon, 16 Dec 2013 16:46:55 +0900 (JST)
Subject: [ruby-changes:32155] ko1:r44234 (trunk): * vm_method.c (rb_method_entry_make): fix WB miss.

ko1	2013-12-16 16:46:48 +0900 (Mon, 16 Dec 2013)

  New Revision: 44234

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

  Log:
    * vm_method.c (rb_method_entry_make): fix WB miss.
      Note that rb_method_entry_t::klass is not constified.
      We may  constify this field.
    * test/ruby/test_alias.rb: add a test.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_alias.rb
    trunk/vm_method.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44233)
+++ ChangeLog	(revision 44234)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec 16 16:40:35 2013  Koichi Sasada  <ko1@a...>
+
+	* vm_method.c (rb_method_entry_make): fix WB miss.
+	  Note that rb_method_entry_t::klass is not constified.
+	  We may  constify this field.
+
+	* test/ruby/test_alias.rb: add a test.
+
 Mon Dec 16 14:14:22 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c: use gc_verify_internal_consistency() instead of
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 44233)
+++ vm_method.c	(revision 44234)
@@ -322,7 +322,7 @@ rb_method_entry_make(VALUE klass, ID mid https://github.com/ruby/ruby/blob/trunk/vm_method.c#L322
     me->flag = NOEX_WITH_SAFE(noex);
     me->mark = 0;
     me->called_id = mid;
-    me->klass = defined_class;
+    OBJ_WRITE(klass, &me->klass, defined_class);
     me->def = def;
 
     if (def) {
Index: test/ruby/test_alias.rb
===================================================================
--- test/ruby/test_alias.rb	(revision 44233)
+++ test/ruby/test_alias.rb	(revision 44234)
@@ -1,4 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_alias.rb#L1
 require 'test/unit'
+require_relative 'envutils'
 
 class TestAlias < Test::Unit::TestCase
   class Alias0
@@ -119,4 +120,16 @@ class TestAlias < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_alias.rb#L120
   def test_super_in_aliased_module_method # fails in 1.8
     assert_equal([:Base, :M], SuperInAliasedModuleMethod::Derived.new.bar)
   end
+
+  def test_alias
+    assert_normal_exit %q{
+      require 'stringio'
+      GC.verify_internal_consistency
+      GC.start
+      class StringIO
+        alias_method :read_nonblock, :sysread
+      end
+      GC.verify_internal_consistency
+    }
+  end
 end

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

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