Since JDK 16 (JDK-8198698 and JDK-8247666), CDS has provided limited optimization for lambda expressions. This has been superseded by JEP 483 and is useful only when -XX:+AOTClassLinking is not enabled (which is the case for the default CDS archive, for compatibility reasons).
The "legacy lambda optimization" may eventually be removed. For the time being, we should consolidate the code into a single source code and clearly mark its uses. This way we can avoid confusion with the JEP 483 code for supporting lambdas (and other java.lang.invoke functionalities).
Background:
With the "legacy lambda optimization", generated lambda proxy classes (with names such as java.util.ResourceBundle$Control$$Lambda/0x80000001d) are stored inside the CDS archive, accessible by LambdaProxyClassDictionary::find_proxy_class(). This saves part of the time for resolving a lambda call site (proxy class generation). However, a significant portion of the cost of the lambda call site resolution still remains in the production run.
With JEP 483 (JDK-8315737), the entire lambda call site (starting from the constant pool entry), is resolved in the AOT cache assembly phase. No extra resolution is needed in the production run.
When JEP 483 is enabled (with -XX:+AOTClassLinking), the "legacy lambda optimization" is disabled.
The "legacy lambda optimization" may eventually be removed. For the time being, we should consolidate the code into a single source code and clearly mark its uses. This way we can avoid confusion with the JEP 483 code for supporting lambdas (and other java.lang.invoke functionalities).
Background:
With the "legacy lambda optimization", generated lambda proxy classes (with names such as java.util.ResourceBundle$Control$$Lambda/0x80000001d) are stored inside the CDS archive, accessible by LambdaProxyClassDictionary::find_proxy_class(). This saves part of the time for resolving a lambda call site (proxy class generation). However, a significant portion of the cost of the lambda call site resolution still remains in the production run.
With JEP 483 (
When JEP 483 is enabled (with -XX:+AOTClassLinking), the "legacy lambda optimization" is disabled.
- links to
-
Commit(master) openjdk/jdk/24833403
-
Review(master) openjdk/jdk/24145