summaryrefslogtreecommitdiff
path: root/bootstraptest/test_yjit.rb
diff options
context:
space:
mode:
authorNoah Gibbs <noah.gibbs@shopify.com>2022-05-21 00:39:37 +0100
committerGitHub <noreply@github.com>2022-05-20 19:39:37 -0400
commit50bad7159a8e1f9846f37421c941f6fa8f087591 (patch)
treea4dce74f53c7e909733f01ebc90d770506365d1f /bootstraptest/test_yjit.rb
parenta97fbc108bd23e669a27356be83c1a515d469af0 (diff)
Special-case jit_guard_known_class for strings. This can remove (#5920)
runtime guard-checks for String#to_s, making some blocks too short to invalidate later. Add NOPs in those cases to reserve space.
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'bootstraptest/test_yjit.rb')
-rw-r--r--bootstraptest/test_yjit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index b0c17229c5..6d0ba93fc8 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1337,6 +1337,16 @@ assert_equal 'foo123', %q{
make_str("foo", 123)
}
+# test that invalidation of String#to_s doesn't crash
+assert_equal 'meh', %q{
+ class String
+ def to_s
+ "meh"
+ end
+ end
+ "".to_s
+}
+
# test string interpolation with overridden to_s
assert_equal 'foo', %q{
class String