Skip to content

Ensure uniform keywords flags in native method annotations#9544

Merged
headius merged 3 commits into
jruby:jruby-10.0from
headius:time_initialize_keywords
Jul 21, 2026
Merged

Ensure uniform keywords flags in native method annotations#9544
headius merged 3 commits into
jruby:jruby-10.0from
headius:time_initialize_keywords

Conversation

@headius

@headius headius commented Jul 21, 2026

Copy link
Copy Markdown
Member

The keywords flag is used by invokedynamic call sites to determine whether kwarg logic should be added to the bound method handle chain. The flag is accessed by inspecting the one NativeCall shipped with the target DynamicMethod to see if its annotation has the flag set.

If the one signature propagated as NativeCall is not uniform with the other bindings, it will inaccurately reflect the keyword needs of those other signatures. As a short-term workaround for this limitation, we make sure all multi-dispatch native methods set the keywords flag uniformly.

This set of fixes was determined by adding a hard check to the DescriptorInfo method, used at binding time to gather method bindings. I'm not comfortable pushing a hard check into JRuby 10.0.x, since this was previously a soft requirement, so only the fixed flags are pushed here. The DescriptorInfo hard check will be pushed for JRuby 10.1.

Fixes #9531 and #9543.

headius added 3 commits July 21, 2026 13:11
Because of how indy logic determines if a target method accepts
keywords (see discussion in jruby#9531), we must make sure
that all annotated signatures set this flag uniformly. If this is
not done, the call logic may incorrectly assume that all signatures
do not accept keywords, breaking keyword-passing behavior.

Fixes jruby#9531
As per jruby#9531, due to limitations in how we bind methods
for indy call sites, we need the keywords flag to be uniform across
all bound signatures. These additional nonuniformities were found
by adding a check to DescriptorInfo and fixing the resulting
errors.

The check will not be pushed for JRuby 10.0, given the risk of
turning this soft requirement into a hard requirement, but I will
push the check for JRuby 10.1 as we work toward improving the
propagation of binding metdata into the method table.
Tests behavior found broken in jruby#9531.

This is not a comprehensive test in that it does not check all
initialize methods that accept keywords, but a hard check will be
pushed for JRuby 10.1 that makes this soft requirement impossible
to ignore.
@headius headius added this to the JRuby 10.0.7.0 milestone Jul 21, 2026
@headius
headius merged commit ed3795a into jruby:jruby-10.0 Jul 21, 2026
125 of 126 checks passed
@headius
headius deleted the time_initialize_keywords branch July 21, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time.new(string, in: ...) raises TypeError on the third call at a call site (JIT only)

1 participant