< prev index next >

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

Print this page

1535                                     emitUnboxing(cob, rtypeK);
1536                                 }
1537 
1538                                 // return statement
1539                                 cob.return_(rtypeK);
1540                             }
1541                         });
1542                     }
1543                 });
1544                 clinit(clb, classEntry, classData);
1545                 bogusMethod(clb, invokerType);
1546             }
1547         });
1548         return classFile;
1549     }
1550 
1551     /**
1552      * Generate bytecode for a NamedFunction invoker.
1553      */
1554     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
1555         MethodType invokerType = NamedFunction.INVOKER_METHOD_TYPE;
1556         String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
1557         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
1558         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
1559     }
1560 
1561     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
1562         MethodType dstType = typeForm.erasedType();
1563         final byte[] classFile = classFileSetup(new Consumer<>() {
1564             @Override
1565             public void accept(ClassBuilder clb) {
1566                 methodSetup(clb, new Consumer<>() {
1567                     @Override
1568                     public void accept(MethodBuilder mb) {
1569 
1570                         mb.with(RuntimeVisibleAnnotationsAttribute.of(List.of(
1571                                 HIDDEN,    // Suppress this method in backtraces displayed to the user.
1572                                 FORCEINLINE // Force inlining of this invoker method.
1573                         )));
1574 
1575                         mb.withCode(new Consumer<>() {

1535                                     emitUnboxing(cob, rtypeK);
1536                                 }
1537 
1538                                 // return statement
1539                                 cob.return_(rtypeK);
1540                             }
1541                         });
1542                     }
1543                 });
1544                 clinit(clb, classEntry, classData);
1545                 bogusMethod(clb, invokerType);
1546             }
1547         });
1548         return classFile;
1549     }
1550 
1551     /**
1552      * Generate bytecode for a NamedFunction invoker.
1553      */
1554     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
1555         MethodType invokerType = NamedFunction.AOTHolder.INVOKER_METHOD_TYPE;
1556         String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
1557         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
1558         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
1559     }
1560 
1561     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
1562         MethodType dstType = typeForm.erasedType();
1563         final byte[] classFile = classFileSetup(new Consumer<>() {
1564             @Override
1565             public void accept(ClassBuilder clb) {
1566                 methodSetup(clb, new Consumer<>() {
1567                     @Override
1568                     public void accept(MethodBuilder mb) {
1569 
1570                         mb.with(RuntimeVisibleAnnotationsAttribute.of(List.of(
1571                                 HIDDEN,    // Suppress this method in backtraces displayed to the user.
1572                                 FORCEINLINE // Force inlining of this invoker method.
1573                         )));
1574 
1575                         mb.withCode(new Consumer<>() {
< prev index next >