From 50bad7159a8e1f9846f37421c941f6fa8f087591 Mon Sep 17 00:00:00 2001 From: Noah Gibbs Date: Sat, 21 May 2022 00:39:37 +0100 Subject: 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. --- bootstraptest/test_yjit.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bootstraptest/test_yjit.rb') 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 -- cgit v1.2.3