Implement special invoker for MH.invokeWithArguments

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 9
    • Component/s: core-libs
    • None

      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.

            Assignee:
            Unassigned
            Reporter:
            Vladimir Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: