Java Code Examples for jdk.internal.dynalink.linker.LinkerServices#asTypeLosslessReturn()
The following examples show how to use
jdk.internal.dynalink.linker.LinkerServices#asTypeLosslessReturn() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: TencentKona-8 File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 2
Source Project: jdk8u60 File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 3
Source Project: openjdk-jdk8u File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 4
Source Project: openjdk-jdk8u-backup File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 5
Source Project: hottub File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 6
Source Project: jdk8u_nashorn File: OverloadedMethod.java License: GNU General Public License v2.0 | 5 votes |
OverloadedMethod(final List<MethodHandle> methodHandles, final OverloadedDynamicMethod parent, final MethodType callSiteType, final LinkerServices linkerServices) { this.parent = parent; final Class<?> commonRetType = getCommonReturnType(methodHandles); this.callSiteType = callSiteType.changeReturnType(commonRetType); this.linkerServices = linkerServices; fixArgMethods = new ArrayList<>(methodHandles.size()); varArgMethods = new ArrayList<>(methodHandles.size()); final int argNum = callSiteType.parameterCount(); for(MethodHandle mh: methodHandles) { if(mh.isVarargsCollector()) { final MethodHandle asFixed = mh.asFixedArity(); if(argNum == asFixed.type().parameterCount()) { fixArgMethods.add(asFixed); } varArgMethods.add(mh); } else { fixArgMethods.add(mh); } } fixArgMethods.trimToSize(); varArgMethods.trimToSize(); final MethodHandle bound = SELECT_METHOD.bindTo(this); final MethodHandle collecting = SingleDynamicMethod.collectArguments(bound, argNum).asType( callSiteType.changeReturnType(MethodHandle.class)); invoker = linkerServices.asTypeLosslessReturn(MethodHandles.foldArguments( MethodHandles.exactInvoker(this.callSiteType), collecting), callSiteType); }
Example 7
Source Project: TencentKona-8 File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }
Example 8
Source Project: jdk8u60 File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }
Example 9
Source Project: openjdk-jdk8u File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }
Example 10
Source Project: openjdk-jdk8u-backup File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }
Example 11
Source Project: hottub File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }
Example 12
Source Project: jdk8u_nashorn File: SingleDynamicMethod.java License: GNU General Public License v2.0 | 4 votes |
private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, final LinkerServices linkerServices, final MethodType callSiteType) { return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); }