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

Methods that do not bind directly with invokedynamic #5246

Open
headius opened this Issue Jul 12, 2018 · 2 comments

Comments

Projects
None yet
1 participant
@headius
Member

headius commented Jul 12, 2018

With the reboot of the JRuby runtime in 9k, we lost some of the invokedynamic logic to bind directly through to method bodies. These cases reverted to "indirect" binding via the DynamicMethod.call path, since their unique call logic did not have an equivalent in the new JIT.

I have been fixing some of these, like Ruby to Java calls and aliased methods, but several remain. I list them here.

I also committed a change adding indirect binding warnings to the debug output from invokedynamic bindings.

  • define_method methods, both those that have been converted into "simple" methods and those that remain a proc.call (affects class attributes and some delegating logic in Rails)
  • Java method arities after the lowest one, varargs logic, and all Java calls that pass a block for closure conversion
  • Variable-arity native methods in core classes, for arities beyond the first defined (affects at least send calls in Rails)
  • Dynamic dispatch methods like send do not create a double call site and will never inline, even for a single target. (affects send calls in Rails, obviously)
  • Struct accessors (affects a number of data objects in Rails)
  • Methods that receive keyword args, due to the need to frobnicate

headius added a commit that referenced this issue Jul 12, 2018

Enable direct binding for keyword args methods.
Ideally we need to slim down or eliminate the frobnicate logic,
since it's over complex and likely will limit the inlining
potential of these call sites.

See #5246.

headius added a commit that referenced this issue Jul 12, 2018

Additional indy binding log improvements.
* Match wording for directly bound jitted methods
* Use method location for printing out method's impl class
* Log when a native method failed to bind directly due to arity

See related work in #5246.
@headius

This comment has been minimized.

Member

headius commented Jul 12, 2018

Kwargs methods now bind directly (0a7419a) by folding in the frobnicated args list. This is a fairly complex set of method handles on top of the already complex frobnication process, but it does appear to help performance of a def foo(a:1) method dispatch by roughly 18% (hot loop on graal went from 0.37s to 0.32s).

headius added a commit that referenced this issue Jul 12, 2018

Bind struct accessors directly with indy. See #5246.
Only the "natural" arities for getters and setters are supported.
@headius

This comment has been minimized.

Member

headius commented Jul 12, 2018

Struct accessors and mutators now bind directly to the RubyStruct methods (8555df3). RubyStruct still needs specialization work, likely based on how we are specializing Object subclasses for instance variables.

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