diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-16 07:46:48 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-16 07:46:48 +0000 |
commit | d8eb7f3c0df627af7e2a961bfdcb069a9cde34ac (patch) | |
tree | d7b034d60275a462b5187af2b84e381c0b20912d | |
parent | c3405de433f3f70451bd4c41a326f8732bd70d8e (diff) |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | test/ruby/test_alias.rb | 13 | ||||
-rw-r--r-- | vm_method.c | 2 |
3 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,11 @@ +Mon Dec 16 16:40:35 2013 Koichi Sasada <[email protected]> + + * 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 <[email protected]> * gc.c: use gc_verify_internal_consistency() instead of diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb index 0fd8d5f89b..32aa92a8d9 100644 --- a/test/ruby/test_alias.rb +++ b/test/ruby/test_alias.rb @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutils' class TestAlias < Test::Unit::TestCase class Alias0 @@ -119,4 +120,16 @@ class TestAlias < Test::Unit::TestCase 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 diff --git a/vm_method.c b/vm_method.c index af336db616..e910e5b941 100644 --- a/vm_method.c +++ b/vm_method.c @@ -322,7 +322,7 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type, 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) { |