Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8078511

Implement special invoker for MH.invokeWithArguments

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd_minor
    • Component/s: core-libs
    • Labels:
      None

      Description

      Consider implementing special invoker for MH.invokeWithArguments().

      Right now, new invoker is created on every invocation.

      src/java.base/share/classes/java/lang/invoke/MethodHandle.java:
          public Object invokeWithArguments(Object... arguments) throws Throwable {
              MethodType invocationType = MethodType.genericMethodType(arguments == null ? 0 : arguments.length);
              return invocationType.invokers().spreadInvoker(0).invokeExact(asType(invocationType), arguments);
          }

      It's still fast (only 5x slower than a direct call) because LambdaForm caching saves lots of work in spreadInvoker(0) case.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                vlivanov Vladimir Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: