Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: Support **nil and empty regular splats #9989

Merged
merged 3 commits into from
Feb 16, 2024
Merged

Conversation

XrXr
Copy link
Member

@XrXr XrXr commented Feb 16, 2024

This adds YJIT support for VM_CALL_KW_SPLAT with nil, specifically for
when we already know from the context that it's done with a nil. This is
enough to support forwarding with ... when there no keyword arguments
are present.

Amend the kw_rest support to propagate the type of the parameter to help
with this. Test interactions with splat, since the splat array sits
lower on the stack when a kw_splat argument is present.


YJIT: Support empty splat

Previously we rejected empty splat calls to methods with no parameters
as iseq_arity_error which didn't work well with delegated calls.


With these two changes we shave about 0.5% of fallbacks on lobsters:

method call fallback reasons: 
-kw_splat:                    231,625 (33.0%)
+iseq_kw_splat_non_nil:        11,965 ( 2.1%)
+cfunc_kw_splat:               43,494 ( 7.6%)
-num_send_dynamic:            891,330 ( 3.3%)
+num_send_dynamic:            751,745 ( 2.8%)

This adds YJIT support for VM_CALL_KW_SPLAT with nil, specifically for
when we already know from the context that it's done with a nil. This is
enough to support forwarding with `...` when there no keyword arguments
are present.

Amend the kw_rest support to propagate the type of the parameter to help
with this. Test interactions with splat, since the splat array sits
lower on the stack when a kw_splat argument is present.
Previously we rejected empty splat calls to methods with no parameters
as `iseq_arity_error` which didn't work well with delegated calls.
@XrXr XrXr marked this pull request as ready for review February 16, 2024 19:45
@matzbot matzbot requested a review from a team February 16, 2024 19:45
@XrXr XrXr changed the title YJIT: Support **nil YJIT: Support **nil and empty regular splats Feb 16, 2024
@XrXr XrXr merged commit b4327c1 into ruby:master Feb 16, 2024
94 of 96 checks passed
@XrXr XrXr deleted the yjit-empty-kwsplat branch February 16, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants