Skip to content

Conversation

@headius
Copy link
Member

@headius headius commented Feb 6, 2026

This PR will implement pass-through keyword arguments for simple cases of calling core methods or calling other keyword-receiving methods. It is meant as a starting point to fully support pass-through of as many forms of keyword-based invocation as possible.

IR changes

  • Associate the kwargs hash with the CallInstr directly, so the call has all metadata for both positional and keyword arguments.

Core changes

  • Introduce annotations and processing to allow specifying keyword-receiving overloads.
  • Identify and modify an existing keyword-argument core method to have a specialized form and redirect generic forms to it. Any methods that accept a single keyword like exception: or nonblock: would be good candidates for now.

JIT changes

Caller side

The caller side indy optimizations can be implemented early and provides benefits without the rest due to moving hash construction and flags-setting into the call site.

  • Embed keywords and kwargs layout into the invokedynamic call site, passing all elements through without constructing a Hash.
  • Implement fallback call site logic that just constructs the hash, sets appropriate flags, and passes it as before.

Callee side

  • Wire up invokedynamic callee side to discover and bind specialized keyword argument paths, similar to the eager arity-splitting logic already introduced.

@headius headius added this to the JRuby 10.1.0.0 milestone Feb 6, 2026
@headius headius force-pushed the true_keyword_arguments branch from bec543f to 9c35a32 Compare February 6, 2026 03:14
@headius headius changed the base branch from master to 10.1-dev February 6, 2026 03:14
This confirms and compiles symbol-only, simple keyword arguments as
a direct operand of the call, to allow downstream optimizations to
prepare those keyword arguments in an appropriate way.

Normal literal hashes and any keyword-like hashes with splats are
compiled as before, with the Hash being built and stored and then
loaded when the argument list is being built. Keyword hashes that
are simple avoid the copy so they are associated directly with the
call.

Order continues to be preserved for the values of the simple kwargs
hash, but the hash itself with its literal keys and any literal
values are now both an operand of and
metadata for the call.
@headius headius force-pushed the true_keyword_arguments branch from 9c35a32 to fd7647d Compare February 6, 2026 03:15
This uses the keyword metadata in CallBase to embed a list of keys
into the call site. This allows sending the kwarg values directly
on the stack, to be passed along to receivers as-is or laily
wrapped in a Hash for older-style receivers.

This does not wire up either of these paths yet and will not
dispatch correctly until the remaining binding logic is in place.
MetaCallSite accepts any number of object arguments with a
descriptor describing the layout of those arguments. From there it
determines the appropriate specialized call site to use for those
arguments.

This will be the initial stage of future invokedynamic binding, to
allow as little custom logic on the call side as possible and all
decisions made during binding.
This wires up methods with only simple keywords, using the fallback
logic of boxing those arguments into a Hash and reinvoking the
existing call sites.
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.

1 participant