summaryrefslogtreecommitdiff
path: root/test/ruby/test_method.rb
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2021-05-13 03:10:18 +0900
committerKoichi Sasada <[email protected]>2021-07-29 00:56:48 +0900
commitfb4cf204a662a8cd9dafef6f31f2bd0db9129abe (patch)
treeb66769f1420ab372f81ea5e5ae53d232cfe60a98 /test/ruby/test_method.rb
parent7af750af8e718acf962578af988883ead55135b3 (diff)
use me->def instead of me for opt_table
`vm_opt_method_table` is me=>bop table to manage the optimized methods (by specialized instruction). However, `me` can be invalidated to invalidate the method cache entry. [Bug #17725] To solve the issue, use `me-def` instead of `me` which simply copied at invalidation timing. A test by @jeremyevans https://github.com/ruby/ruby/pull/4376
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4493
Diffstat (limited to 'test/ruby/test_method.rb')
-rw-r--r--test/ruby/test_method.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 240821c9e2..0bd5dc63dd 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1303,6 +1303,21 @@ class TestMethod < Test::Unit::TestCase
end;
end
+ def test_override_optimized_method_on_class_using_prepend
+ assert_separately(%w(--disable-gems), <<-'end;', timeout: 30)
+ # Bug #17725 [ruby-core:102884]
+ $VERBOSE = nil
+ String.prepend(Module.new)
+ class String
+ def + other
+ 'blah blah'
+ end
+ end
+
+ assert_equal('blah blah', 'a' + 'b')
+ end;
+ end
+
def test_eqq
assert_operator(0.method(:<), :===, 5)
assert_not_operator(0.method(:<), :===, -5)