JDK-8251851 : InvokerBytecodeGenerator::lookupPregenerated does not support all cases
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2020-08-15
  • Updated: 2023-07-20
Related Reports
Relates :  
Relates :  
Relates :  
Description
http://hg.openjdk.java.net/jdk/jdk/file/8ada048df69d/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java#l704

It can return null in certain cases:

        if (form.customized != null) {
            // No pre-generated version for customized LF
            return null; <<<<<<
        }
        switch (form.kind) {
            case XXXX: return resolveFrom(xxxx);
            case YYYY: return resolveFrom(yyyy ....);
        }
        return null; <<<<<<

As a result, for JDK-8247536, we cannot pre-generate all the needed code for "javac HelloWorld.java". About 8 classes are dynamically generated at runtime -- 1 for the first case and 7 for the second case

---------

Supporting (form.customized != null) will be hard. However, for the second case, maybe we are missing some cases in the switch statement that can be implemeted?