Why some methods in java.base cannot be compiled by the AOT compiler

According to JEP-295 ( http://openjdk.java.net/jeps/295 )

There are several methods in java.base that cause the compilation to fail, but why?

It's clear that someone can help me so that I can implement the OpenJDK AOT compiler limitation.

+6
source share
1 answer

See the documentation you link to:

Current AOT restrictions ...

It is not possible to compile java code that uses dynamically generated classes and bytecode (lambda expressions, dynamic calls).

These restrictions may be removed in future releases.

So there are two potential explanations:

  • , , .
  • " , "

, " 2" - - . .

, , :

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;

, getContents() - lambdas.

, , , , " " Java!

+5

All Articles