< prev index next >

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

Print this page

1561                                     emitUnboxing(cob, rtypeK);
1562                                 }
1563 
1564                                 // return statement
1565                                 cob.return_(rtypeK);
1566                             }
1567                         });
1568                     }
1569                 });
1570                 clinit(clb, classDesc, classData);
1571                 bogusMethod(clb, invokerType);
1572             }
1573         });
1574         return classFile;
1575     }
1576 
1577     /**
1578      * Generate bytecode for a NamedFunction invoker.
1579      */
1580     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
1581         MethodType invokerType = NamedFunction.INVOKER_METHOD_TYPE;
1582         String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
1583         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
1584         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
1585     }
1586 
1587     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
1588         MethodType dstType = typeForm.erasedType();
1589         final byte[] classFile = classFileSetup(new Consumer<ClassBuilder>() {
1590             @Override
1591             public void accept(ClassBuilder clb) {
1592                 methodSetup(clb, new Consumer<MethodBuilder>() {
1593                     @Override
1594                     public void accept(MethodBuilder mb) {
1595 
1596                         mb.with(RuntimeVisibleAnnotationsAttribute.of(List.of(
1597                                 HIDDEN,    // Suppress this method in backtraces displayed to the user.
1598                                 FORCEINLINE // Force inlining of this invoker method.
1599                         )));
1600 
1601                         mb.withCode(new Consumer<CodeBuilder>() {

1561                                     emitUnboxing(cob, rtypeK);
1562                                 }
1563 
1564                                 // return statement
1565                                 cob.return_(rtypeK);
1566                             }
1567                         });
1568                     }
1569                 });
1570                 clinit(clb, classDesc, classData);
1571                 bogusMethod(clb, invokerType);
1572             }
1573         });
1574         return classFile;
1575     }
1576 
1577     /**
1578      * Generate bytecode for a NamedFunction invoker.
1579      */
1580     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
1581         MethodType invokerType = NamedFunction.AOTHolder.INVOKER_METHOD_TYPE;
1582         String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
1583         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
1584         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
1585     }
1586 
1587     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
1588         MethodType dstType = typeForm.erasedType();
1589         final byte[] classFile = classFileSetup(new Consumer<ClassBuilder>() {
1590             @Override
1591             public void accept(ClassBuilder clb) {
1592                 methodSetup(clb, new Consumer<MethodBuilder>() {
1593                     @Override
1594                     public void accept(MethodBuilder mb) {
1595 
1596                         mb.with(RuntimeVisibleAnnotationsAttribute.of(List.of(
1597                                 HIDDEN,    // Suppress this method in backtraces displayed to the user.
1598                                 FORCEINLINE // Force inlining of this invoker method.
1599                         )));
1600 
1601                         mb.withCode(new Consumer<CodeBuilder>() {
< prev index next >