In the context of libgraal, the current use of ServiceLoader in JVMCI is problematic as libgraal does all class loading at image build time. There are static fields such as JVMCIServiceLocator.cachedLocators that need to be initialized via reflection[1] when building libgraal. This can be avoided if JVMCI performs all ServiceLoader usage in <clinit> as <clinit> is executed when building a native image.
[1] https://github.com/oracle/graal/blob/30492c3f7847a13ae7f8dc50663a5a039e49a8e7/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java#L175-L180
[1] https://github.com/oracle/graal/blob/30492c3f7847a13ae7f8dc50663a5a039e49a8e7/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/libgraal/BuildTime.java#L175-L180
- causes
-
JDK-8350263 JvmciNotifyBootstrapFinishedEventTest intermittently times out
-
- Resolved
-
- relates to
-
JDK-8346825 [JVMCI] Remove NativeImageReinitialize annotation
-
- Open
-
- links to
-
Commit(master) openjdk/jdk/8ec58939
-
Review(master) openjdk/jdk/22869