According to JEP-295 (http://openjdk.java.net/jeps/295)
There are some methods in java.base causing compilation failure, but why?
It will be appreciated that someone can help me so that I can realize limitation of Openjdk AOT compiler.
Ahead-Of-Time (AOT) compilation allows the compilation of Java™ classes into native code for subsequent executions of the same program. The AOT compiler works with the class data sharing framework.
AOT compilation is one way of improving the performance of Java programs and in particular the startup time of the JVM. The JVM executes Java bytecode and compiles frequently executed code to native code. This is called Just-in-Time (JIT) Compilation.
See the documentation you are linking to:
Current AOT limitations ...
May not compile java code which uses dynamically generated classes and bytecode (lambda expressions, invoke dynamic).
These limitations may be addressed in future releases.
Thus two potential explanations:
Most likely "option 2" is the better explanation - see again your link.
It contains a list of methods that fail compilation, together with the error that occurs:
cat java.base-list.txt
# jaotc: java.lang.StackOverflowError
exclude sun.util.resources.LocaleNames.getContents()[[Ljava/lang/Object;
exclude sun.util.resources.TimeZoneNames.getContents()[[Ljava/lang/Object;
exclude sun.util.resources.cldr.LocaleNames.getContents()[[Ljava/lang/Object;
exclude sun.util.resources..*.LocaleNames_.*.getContents\(\)\[\[Ljava/lang/Object;
exclude sun.util.resources..*.LocaleNames_.*_.*.getContents\(\)\[\[Ljava/lang/Object;
exclude sun.util.resources..*.TimeZoneNames_.*.getContents\(\)\[\[Ljava/lang/Object;
exclude sun.util.resources..*.TimeZoneNames_.*_.*.getContents\(\)\[\[Ljava/lang/Object;
# java.lang.Error: Trampoline must not be defined by the bootstrap classloader
exclude sun.reflect.misc.Trampoline.<clinit>()V
exclude sun.reflect.misc.Trampoline.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
# JVM asserts
exclude com.sun.crypto.provider.AESWrapCipher.engineUnwrap([BLjava/lang/String;I)Ljava/security/Key;
exclude sun.security.ssl.*
exclude sun.net.RegisteredDomain.<clinit>()V
# Huge methods
exclude jdk.internal.module.SystemModules.descriptors()[Ljava/lang/module/ModuleDescriptor;
And when you check the sources, for example getContents() - no lambdas there.
So the methods that fail compilation are most likely caused by the fact that the new compiler is "not yet ready" to successfully compile arbitrary Java source code!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With