Skip to content

ZJIT: Specialize Proc#call with explicit keyword arguments #1127

Open
ruby/ruby
#19901

Description

@nozomemein

OptimizedMethodType::Call rejects VM_CALL_KWARG.
We could pack explicit keywords into a Hash and reuse InvokeProc.

# ./miniruby --zjit-call-threshold=2 --zjit-dump-hir test.rb
def invoke(callable)
  callable.call(value: 1)
end

callable = proc { |value:| value }
p invoke(callable) # => 1
p invoke(callable) # => 1

This pattern appears in liquid-il.

# liquid-li
Top-1 popular complex argument-parameter features not optimized (100.0% of total 1,333,002):
  caller_kwarg: 1,333,002 (100.0%)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions