diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2024-03-18 12:02:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 16:02:22 +0000 |
commit | 802e857ae6553bdc441d11892af0259a400f504e (patch) | |
tree | 29656b01e09eb04fd56de2848a8ba573788fc2ff /bootstraptest | |
parent | 97810cbbf2bf3346c6ad7bd67b38808f0eb11d61 (diff) |
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 <maxime.chevalierboisvert@shopify.com>
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 16 |
1 files changed, 16 insertions, 0 deletions
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) +} |