1803 } 1804 1805 @Override 1806 public byte[] generateInvokersHolderClassBytes(final String className, 1807 MethodType[] methodTypes) { 1808 return GenerateJLIClassesHelper 1809 .generateInvokersHolderClassBytes(className, methodTypes); 1810 } 1811 }); 1812 } 1813 1814 /** Result unboxing: ValueConversions.unbox() OR ValueConversions.identity() OR ValueConversions.ignore(). */ 1815 private static MethodHandle unboxResultHandle(Class<?> returnType) { 1816 if (returnType.isPrimitive()) { 1817 if (returnType == void.class) { 1818 return ValueConversions.ignore(); 1819 } else { 1820 Wrapper w = Wrapper.forPrimitiveType(returnType); 1821 return ValueConversions.unboxExact(w); 1822 } 1823 } else { 1824 return MethodHandles.identity(Object.class); 1825 } 1826 } 1827 1828 /** 1829 * Assembles a loop method handle from the given handles and type information. 1830 * 1831 * @param tloop the return type of the loop. 1832 * @param targs types of the arguments to be passed to the loop. 1833 * @param init sanitized array of initializers for loop-local variables. 1834 * @param step sanitited array of loop bodies. 1835 * @param pred sanitized array of predicates. 1836 * @param fini sanitized array of loop finalizers. 1837 * 1838 * @return a handle that, when invoked, will execute the loop. 1839 */ 1840 static MethodHandle makeLoop(Class<?> tloop, List<Class<?>> targs, List<MethodHandle> init, List<MethodHandle> step, 1841 List<MethodHandle> pred, List<MethodHandle> fini) { 1842 MethodType type = MethodType.methodType(tloop, targs); | 1803 } 1804 1805 @Override 1806 public byte[] generateInvokersHolderClassBytes(final String className, 1807 MethodType[] methodTypes) { 1808 return GenerateJLIClassesHelper 1809 .generateInvokersHolderClassBytes(className, methodTypes); 1810 } 1811 }); 1812 } 1813 1814 /** Result unboxing: ValueConversions.unbox() OR ValueConversions.identity() OR ValueConversions.ignore(). */ 1815 private static MethodHandle unboxResultHandle(Class<?> returnType) { 1816 if (returnType.isPrimitive()) { 1817 if (returnType == void.class) { 1818 return ValueConversions.ignore(); 1819 } else { 1820 Wrapper w = Wrapper.forPrimitiveType(returnType); 1821 return ValueConversions.unboxExact(w); 1822 } 1823 } else if (MinimalValueTypes_1_0.isValueType(returnType)) { 1824 return ValueType.forClass(MinimalValueTypes_1_0.getValueCapableClass(returnType)).unbox(); 1825 } else { 1826 return MethodHandles.identity(Object.class); 1827 } 1828 } 1829 1830 /** 1831 * Assembles a loop method handle from the given handles and type information. 1832 * 1833 * @param tloop the return type of the loop. 1834 * @param targs types of the arguments to be passed to the loop. 1835 * @param init sanitized array of initializers for loop-local variables. 1836 * @param step sanitited array of loop bodies. 1837 * @param pred sanitized array of predicates. 1838 * @param fini sanitized array of loop finalizers. 1839 * 1840 * @return a handle that, when invoked, will execute the loop. 1841 */ 1842 static MethodHandle makeLoop(Class<?> tloop, List<Class<?>> targs, List<MethodHandle> init, List<MethodHandle> step, 1843 List<MethodHandle> pred, List<MethodHandle> fini) { 1844 MethodType type = MethodType.methodType(tloop, targs); |