< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java

Print this page
rev 15353 : 8164044: Generate the corresponding BoundMethodHandle to all generated DirectMethodHandles
Reviewed-by: vlivanov, mhaupt


1701 
1702         SharedSecrets.setJavaLangInvokeAccess(new JavaLangInvokeAccess() {
1703             @Override
1704             public Object newMemberName() {
1705                 return new MemberName();
1706             }
1707 
1708             @Override
1709             public String getName(Object mname) {
1710                 MemberName memberName = (MemberName)mname;
1711                 return memberName.getName();
1712             }
1713 
1714             @Override
1715             public boolean isNative(Object mname) {
1716                 MemberName memberName = (MemberName)mname;
1717                 return memberName.isNative();
1718             }
1719 
1720             @Override
1721             public byte[] generateDMHClassBytes(String className,
1722             MethodType[] methodTypes, int[] types) {
1723                 return GenerateJLIClassesHelper
1724                         .generateDMHClassBytes(className, methodTypes, types);









1725             }
1726 
1727             @Override
1728             public Map.Entry<String, byte[]> generateConcreteBMHClassBytes(
1729                     final String types) {
1730                 return GenerateJLIClassesHelper
1731                         .generateConcreteBMHClassBytes(types);
1732             }
1733         });
1734     }
1735 
1736     /** Result unboxing: ValueConversions.unbox() OR ValueConversions.identity() OR ValueConversions.ignore(). */
1737     private static MethodHandle unboxResultHandle(Class<?> returnType) {
1738         if (returnType.isPrimitive()) {
1739             if (returnType == void.class) {
1740                 return ValueConversions.ignore();
1741             } else {
1742                 Wrapper w = Wrapper.forPrimitiveType(returnType);
1743                 return ValueConversions.unboxExact(w);
1744             }




1701 
1702         SharedSecrets.setJavaLangInvokeAccess(new JavaLangInvokeAccess() {
1703             @Override
1704             public Object newMemberName() {
1705                 return new MemberName();
1706             }
1707 
1708             @Override
1709             public String getName(Object mname) {
1710                 MemberName memberName = (MemberName)mname;
1711                 return memberName.getName();
1712             }
1713 
1714             @Override
1715             public boolean isNative(Object mname) {
1716                 MemberName memberName = (MemberName)mname;
1717                 return memberName.isNative();
1718             }
1719 
1720             @Override
1721             public byte[] generateDirectMethodHandleHolderClassBytes(
1722                     String className, MethodType[] methodTypes, int[] types) {
1723                 return GenerateJLIClassesHelper
1724                         .generateDirectMethodHandleHolderClassBytes(
1725                                 className, methodTypes, types);
1726             }
1727 
1728             @Override
1729             public byte[] generateDelegatingMethodHandleHolderClassBytes(
1730                     String className, MethodType[] methodTypes) {
1731                 return GenerateJLIClassesHelper
1732                         .generateDelegatingMethodHandleHolderClassBytes(
1733                                 className, methodTypes);
1734             }
1735 
1736             @Override
1737             public Map.Entry<String, byte[]> generateConcreteBMHClassBytes(
1738                     final String types) {
1739                 return GenerateJLIClassesHelper
1740                         .generateConcreteBMHClassBytes(types);
1741             }
1742         });
1743     }
1744 
1745     /** Result unboxing: ValueConversions.unbox() OR ValueConversions.identity() OR ValueConversions.ignore(). */
1746     private static MethodHandle unboxResultHandle(Class<?> returnType) {
1747         if (returnType.isPrimitive()) {
1748             if (returnType == void.class) {
1749                 return ValueConversions.ignore();
1750             } else {
1751                 Wrapper w = Wrapper.forPrimitiveType(returnType);
1752                 return ValueConversions.unboxExact(w);
1753             }


< prev index next >