summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-03-09 11:01:16 -0800
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:31 -0400
commitc15a577eda78f1944ade1e9ae1bdadeaeee3c8d7 (patch)
treee9e8c4d25de126986dc700bfc82e13a69e5531cc /bootstraptest
parent46874b8fb979d0bf46d5d3b6e1523293201441e8 (diff)
Make Blocks depend on BOPS
When a BOP is redefined, the BOP redefinition callback will invalidate any blocks that depend on BOPS. This allows us to eliminate runtime checks for BOP redefinition.
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index cf79ccd101..f7e1fe4a7e 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1,3 +1,38 @@
+# BOP redefined methods work when JIT compiled
+assert_equal 'false', %q{
+ def less_than x
+ x < 10
+ end
+
+ class Integer
+ def < x
+ false
+ end
+ end
+
+ less_than 2
+ less_than 2
+ less_than 2
+}
+
+# BOP redefinition works on Integer#<
+assert_equal 'false', %q{
+ def less_than x
+ x < 10
+ end
+
+ less_than 2
+ less_than 2
+
+ class Integer
+ def < x
+ false
+ end
+ end
+
+ less_than 2
+}
+
# Putobject, less-than operator, fixnums
assert_equal '2', %q{
def check_index(index)