summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-02-16 17:22:44 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2023-02-16 18:50:42 -0500
commitc178926fbe879045fa711444a1fd9e906af23e3b (patch)
tree7933d3ad395eb500b03fd37857c982101504b225 /test
parenta49bc73e1f33e8a0e40ff0c3fef6c6fe749f8179 (diff)
YJIT: jit_prepare_routine_call() for String#+@ missing
We saw SEGVs due to this when running with StackProf, which needs a correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for ObjectSpace allocation tracing. [Bug #19444]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7328
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_yjit.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 6627a78628..2428a401cf 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -1092,6 +1092,33 @@ class TestYJIT < Test::Unit::TestCase
RUBY
end
+ def test_tracing_str_uplus
+ assert_compiles(<<~RUBY, frozen_string_literal: true, result: :ok)
+ def str_uplus
+ _ = 1
+ _ = 2
+ ret = [+"frfr", __LINE__]
+ _ = 3
+ _ = 4
+
+ ret
+ end
+
+ str_uplus
+ require 'objspace'
+ ObjectSpace.trace_object_allocations_start
+
+ str, expected_line = str_uplus
+ alloc_line = ObjectSpace.allocation_sourceline(str)
+
+ if expected_line == alloc_line
+ :ok
+ else
+ [expected_line, alloc_line]
+ end
+ RUBY
+ end
+
private
def code_gc_helpers