summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-30 13:16:11 -0800
committerGitHub <noreply@github.com>2022-11-30 16:16:11 -0500
commit0d3fc08ff46cdfa389170db6141f1747d5d9d283 (patch)
tree9b2cfe8198f99bc709135d8cf69481ccec6de85b /test
parentd98d84b75dab450070ff3dc7154661a9941fb44d (diff)
YJIT: Optimize rb_int_equal (#6838)
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_yjit.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index a4e584a07c..aa29cf471f 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -827,6 +827,22 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_int_equal
+ assert_compiles(<<~'RUBY', exits: :any, result: [true, false, true, false, true, false, true, false])
+ def eq(a, b)
+ a == b
+ end
+
+ def eqq(a, b)
+ a === b
+ end
+
+ big1 = 2 ** 65
+ big2 = big1 + 1
+ [eq(1, 1), eq(1, 2), eq(big1, big1), eq(big1, big2), eqq(1, 1), eqq(1, 2), eqq(big1, big1), eqq(big1, big2)]
+ RUBY
+ end
+
def test_code_gc
assert_compiles(code_gc_helpers + <<~'RUBY', exits: :any, result: :ok)
return :not_paged unless add_pages(100) # prepare freeable pages