diff options
author | Peter Zhu <[email protected]> | 2024-10-15 12:55:05 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-10-15 14:34:24 -0400 |
commit | f45eb3dcb9c7d849064cb802953f37e1cf9f3996 (patch) | |
tree | 1a4d39d9c4220d30e8fbea57d097a44dd2f8eebb | |
parent | 644153bfa8255903d0c0b7b3013bda3b33f6c706 (diff) |
Use GC.respond_to?(:compact) in bootstraptest/test_yjit.rb
defined?(GC.compact) will always return true even when compaction is not
supported. We should use GC.respond_to?(:compact) instead.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11898
-rw-r--r-- | bootstraptest/test_yjit.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index f0192c0414..545243a0e4 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -123,7 +123,7 @@ assert_equal '[:ae, :ae]', %q{ # regression test for GC marking stubs in invalidated code assert_normal_exit %q{ - skip true unless defined?(GC.compact) + skip true unless GC.respond_to?(:compact) garbage = Array.new(10_000) { [] } # create garbage to cause iseq movement eval(<<~RUBY) def foo(n, garbage) @@ -158,7 +158,7 @@ assert_equal '0', "0.abs(&nil)" # regression test for invokeblock iseq guard assert_equal 'ok', %q{ - skip :ok unless defined?(GC.compact) + skip :ok unless GC.respond_to?(:compact) def foo = yield 10.times do |i| ret = eval("foo { #{i} }") @@ -1230,7 +1230,7 @@ assert_equal 'special', %q{ # Test that object references in generated code get marked and moved assert_equal "good", %q{ - skip :good unless defined?(GC.compact) + skip :good unless GC.respond_to?(:compact) def bar "good" end @@ -2351,7 +2351,7 @@ assert_equal '123', %q{ # Test EP == BP invalidation with moving ISEQs assert_equal 'ok', %q{ - skip :ok unless defined?(GC.compact) + skip :ok unless GC.respond_to?(:compact) def entry ok = proc { :ok } # set #entry as an EP-escaping ISEQ [nil].reverse_each do # avoid exiting the JIT frame on the constant |