-
JEP
-
Resolution: Unresolved
-
P4
-
None
-
Vladimir Kozlov
-
Feature
-
Open
-
Implementation
-
-
M
-
M
Summary
Support JVMCI based Just-In-Time Compiler (such as Graal) which is Ahead-Of-Time compiled into a native shared library.
Goals
To replace native compilers in HotSpot (i.e., C1 and C2), JVMCI based Compiler should have the following characteristics:
- fast startup
- compile time similar to native compilers
- memory usage disjoint from the application Java heap
- bulk de-allocation of memory used during a single compilation
- do not pollute profiling of JDK code used by the application.
Description
The best way to achieve this is to compile such Compiler with SubstrateVM native-image tool into a shared library that HotSpot VM can interface with via JNI. This requires:
- A technology by which JVMCI and Compiler can be compiled into a shared library that implements the JNI Invocation API
- Enhancements to JVMCI to support both producing and using SVM compiled shared library.
JVMCI C++ code would need to operate on JVMCI Java objects in 2 different heaps - the HotSpot heap and the shared library heap. We'll introduce JVMCIObject, a wrapper that abstracts over whether a Java object is a HotSpot oop or a JNI jobject.
The JVMCIRuntime C++ class would be converted to have non-static methods and be instantiated one instance per HotSpotJVMCIRutime Java object in each heap. It would include methods that allow invoking JVMCI Java methods, abstracting over whether calling into the HotSpot or shared library runtime.
Care must be taken to handle cross-runtime-heap objects references.
Compiler's shared library (libjvmcicompiler.so) will be generated during JDK build according to configure setting.
New HotSpot flags will be added:
-XX:+UseJVMCINativeLibrary to load shared library from default location (in JDK directory)
-XX:JVMCILibPath="path" to specify library location
Dependencies
These implementation requirse JVMCI changes which are tracked by RFE JDK-8220623
- duplicates
-
JDK-8204853 [JVMCI][Graal] add support for AOT compiling Graal with SubstrateVM
- Closed
- is blocked by
-
JDK-8220623 [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
- Resolved