568 private static final MethodHandle IS_ANNOTATED_METHOD_NOT_NULL = Guards.isNotNull().asType(MethodType.methodType( |
568 private static final MethodHandle IS_ANNOTATED_METHOD_NOT_NULL = Guards.isNotNull().asType(MethodType.methodType( |
569 boolean.class, AnnotatedDynamicMethod.class)); |
569 boolean.class, AnnotatedDynamicMethod.class)); |
570 private static final MethodHandle CONSTANT_NULL_DROP_ANNOTATED_METHOD = MethodHandles.dropArguments( |
570 private static final MethodHandle CONSTANT_NULL_DROP_ANNOTATED_METHOD = MethodHandles.dropArguments( |
571 MethodHandles.constant(Object.class, null), 0, AnnotatedDynamicMethod.class); |
571 MethodHandles.constant(Object.class, null), 0, AnnotatedDynamicMethod.class); |
572 private static final MethodHandle GET_ANNOTATED_METHOD = privateLookup.findVirtual(AnnotatedDynamicMethod.class, |
572 private static final MethodHandle GET_ANNOTATED_METHOD = privateLookup.findVirtual(AnnotatedDynamicMethod.class, |
573 "getTarget", MethodType.methodType(MethodHandle.class, MethodHandles.Lookup.class)); |
573 "getTarget", MethodType.methodType(MethodHandle.class, MethodHandles.Lookup.class, LinkerServices.class)); |
574 private static final MethodHandle GETTER_INVOKER = MethodHandles.invoker(MethodType.methodType(Object.class, Object.class)); |
574 private static final MethodHandle GETTER_INVOKER = MethodHandles.invoker(MethodType.methodType(Object.class, Object.class)); |
575 |
575 |
576 private GuardedInvocationComponent getPropertyGetter(final CallSiteDescriptor callSiteDescriptor, |
576 private GuardedInvocationComponent getPropertyGetter(final CallSiteDescriptor callSiteDescriptor, |
577 final LinkerServices linkerServices, final List<String> ops) throws Exception { |
577 final LinkerServices linkerServices, final List<String> ops) throws Exception { |
578 switch(callSiteDescriptor.getNameTokenCount()) { |
578 switch(callSiteDescriptor.getNameTokenCount()) { |
591 // or delegate to next component's invocation. |
591 // or delegate to next component's invocation. |
592 |
592 |
593 final MethodHandle typedGetter = linkerServices.asType(getPropertyGetterHandle, type.changeReturnType( |
593 final MethodHandle typedGetter = linkerServices.asType(getPropertyGetterHandle, type.changeReturnType( |
594 AnnotatedDynamicMethod.class)); |
594 AnnotatedDynamicMethod.class)); |
595 final MethodHandle callSiteBoundMethodGetter = MethodHandles.insertArguments( |
595 final MethodHandle callSiteBoundMethodGetter = MethodHandles.insertArguments( |
596 GET_ANNOTATED_METHOD, 1, callSiteDescriptor.getLookup()); |
596 GET_ANNOTATED_METHOD, 1, callSiteDescriptor.getLookup(), linkerServices); |
597 final MethodHandle callSiteBoundInvoker = MethodHandles.filterArguments(GETTER_INVOKER, 0, |
597 final MethodHandle callSiteBoundInvoker = MethodHandles.filterArguments(GETTER_INVOKER, 0, |
598 callSiteBoundMethodGetter); |
598 callSiteBoundMethodGetter); |
599 // Object(AnnotatedDynamicMethod, Object)->Object(AnnotatedDynamicMethod, T0) |
599 // Object(AnnotatedDynamicMethod, Object)->Object(AnnotatedDynamicMethod, T0) |
600 final MethodHandle invokeHandleTyped = linkerServices.asType(callSiteBoundInvoker, |
600 final MethodHandle invokeHandleTyped = linkerServices.asType(callSiteBoundInvoker, |
601 MethodType.methodType(type.returnType(), AnnotatedDynamicMethod.class, type.parameterType(0))); |
601 MethodType.methodType(type.returnType(), AnnotatedDynamicMethod.class, type.parameterType(0))); |
871 MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) { |
871 MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) { |
872 return method.getInvocation(callSiteDescriptor, linkerServices); |
872 return method.getInvocation(callSiteDescriptor, linkerServices); |
873 } |
873 } |
874 |
874 |
875 @SuppressWarnings("unused") |
875 @SuppressWarnings("unused") |
876 MethodHandle getTarget(final MethodHandles.Lookup lookup) { |
876 MethodHandle getTarget(final MethodHandles.Lookup lookup, final LinkerServices linkerServices) { |
877 final MethodHandle inv = method.getTarget(lookup); |
877 final MethodHandle inv = linkerServices.filterInternalObjects(method.getTarget(lookup)); |
878 assert inv != null; |
878 assert inv != null; |
879 return inv; |
879 return inv; |
880 } |
880 } |
881 } |
881 } |
882 } |
882 } |