From 762a3d80f77db0f96d3e01ccd1cc7b3891f0cfcf Mon Sep 17 00:00:00 2001 From: Jimmy Miller Date: Thu, 19 Jan 2023 13:42:49 -0500 Subject: Implement splat for cfuncs. Split exit exit cases to better capture where we are exiting (#6929) YJIT: Implement splat for cfuncs. Split exit cases This also implements a new check for ruby2keywords as the last argument of a splat. This does mean that we generate more code, but in actual benchmarks where we gained speed from this (binarytrees) I don't see any significant slow down. I did have to struggle here with the register allocator to find code that didn't allocate too many registers. It's a bit hard when everything is implicit. But I think I got to the minimal amount of copying and stuff given our current allocation strategy. --- bootstraptest/test_yjit.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 9d9143d265..cbb3f145b0 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -3456,3 +3456,28 @@ assert_equal 'ok', %q{ cw(4) } + +assert_equal 'threw', %q{ + def foo(args) + wrap(*args) + rescue ArgumentError + 'threw' + end + + def wrap(a) + [a] + end + + foo([Hash.ruby2_keywords_hash({})]) +} + +assert_equal 'threw', %q{ + # C call + def bar(args) + Array(*args) + rescue ArgumentError + 'threw' + end + + bar([Hash.ruby2_keywords_hash({})]) +} -- cgit v1.2.1