/** * Return a method handle to invoke on the callerType, target, and remaining arguments. The method * handle must finish the call. This is the first look at the caller type and target. */ private MethodHandle dispatch(MethodType callerType, MethodHandle target) { MethodType targetType = target.type(); if (USE_AS_TYPE_PATH || target.isVarargsCollector()) { MethodHandle newTarget = target.asType(callerType); targetType = callerType; Invokers invokers = targetType.invokers(); MethodHandle invoker = invokers.erasedInvokerWithDrops; if (invoker == null) { invokers.erasedInvokerWithDrops = invoker = dropDispatchArguments(invokers.erasedInvoker()); } return invoker.bindTo(newTarget); } throw new RuntimeException("NYI"); }
private MethodHandle makePostDispatchInvoker() { // Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...). MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS); return invokerType.invokers().exactInvoker(); }