From 802e857ae6553bdc441d11892af0259a400f504e Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 18 Mar 2024 12:02:22 -0400 Subject: YJIT: Support arity=-2 cfuncs (#10268) This type of cfuncs shows up as consume a lot of cycles in profiles of the lobsters benchmark, even though in the stats they don't happen that frequently. Might be a bug in the profiling, but these calls are not too bad to support, so might as well do it. Co-authored-by: Maxime Chevalier-Boisvert --- bootstraptest/test_yjit.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 6fc0d48c87..ddd1e321a0 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -4678,3 +4678,19 @@ assert_equal '[0, {1=>1}]', %q{ test(KwInit, [Hash.ruby2_keywords_hash({1 => 1})]) } + +# arity=-2 cfuncs +assert_equal '["", "1/2", [0, [:ok, 1]]]', %q{ + def test_cases(file, chain) + new_chain = chain.allocate # to call initialize directly + new_chain.send(:initialize, [0], ok: 1) + + [ + file.join, + file.join("1", "2"), + new_chain.to_a, + ] + end + + test_cases(File, Enumerator::Chain) +} -- cgit v1.2.3