-
JEP
-
Resolution: Delivered
-
P1
-
Feature
-
Open
-
JDK
-
-
M
-
M
-
243
Summary
Develop a Java based JVM compiler interface (JVMCI) enabling a compiler written in Java to be used by the JVM as a dynamic compiler.
Goals
Allow a Java component programmed against the JVMCI to be loaded at runtime and used by the JVM’s compile broker.
Allow a Java component programmed against the JVMCI to be loaded at runtime and used by trusted Java code to install machine code in the JVM that can be called via a Java reference to the installed code.
Non-Goals
- Integration of a dynamic compiler (such as Graal) based on JVMCI.
Success Metrics
- The ability of a JVMCI based dynamic compiler to run on the unmodified JVM. The performance of compiler and its generated code are not of high concern since JVMCI will be an experimental feature in JDK 9 and as such only enabled by specifying certain flags on the command line.
Motivation
An optimizing compiler is a complex piece of software that benefits greatly from the features provided by Java such as automatic memory management, exception handling, synchronization, excellent (and free) IDEs, excellent unit testing support and runtime extensibility via service loaders just to name a few. In addition, a compiler does not require the low-level language features required by many other JVM subsystems such as the bytecode interpreter and garbage collector. These observations strongly suggest that writing a JVM compiler in Java should allow production of a high quality compiler that will be easier to maintain and improve than existing compilers developed in C or C++. JVMCI provides the API necessary to demonstrate and experiment with this potential.
Description
The JVMCI API will be composed of mechanisms for:
- Accessing VM data structures required by an optimizing bytecode-to-machine-code compiler such as classes, fields, methods, profiling information etc.
- Installing compiled code along with all the metadata required by the JVM for managing compiled code such as GC maps and information to support deoptimization.
- Plugging into the JVM's compilation system to handle servicing JVM requests to produce machine code for methods.
An excellent demonstration of using JVMCI to write and deploy a high performance compiler in the JVM is provided by Graal which has demonstrated peak performance on par with C2 across a wide range of benchmarks.
Alternatives
There are no existing alternatives for a Java based compiler that is usable as a dynamic compiler in the JVM.
Testing
The JVMCI implementation includes an extensive set of unit tests for the parts of the API exposed to a compiler developer as well as white box tests for internal parts that makes calls into the VM to implement the public parts.
Risks and Assumptions
A Java API that allows VM internals to be accessed and compiled code to be installed and executed presents an obvious security risk. In JDK8 (where JVMCI was first prototyped and is still co-developed along with the JDK 9 port), the JVMCI API was hidden from untrusted code by loading it with a class loader inaccessible to anything but code on the boot class path. In JDK 9, the intention is to use access controls that are part of the Module System JEP 261 to prevent untrusted code from being able to use JVMCI. JVMCI needs to be as secured as the Unsafe class is.
JVMCI will be experimental in JDK 9 and such will require extra command line options to enable it. For example:
-XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Djvmci.Compiler=<name of compiler>
Making JVMCI experimental allows for extensive experimentation while mitigating any risk to JVM customers.
Dependencies
As mentioned above, JVMCI is dependent on the access controls in JEP 261 to isolate JVMCI from untrusted code.
- duplicates
-
JDK-8031639 make dependency management (mostly) ci independent
-
- Closed
-
- is blocked by
-
JDK-8078350 JEP-JDK-8062493: [jvmci] Test task: get events
-
- Resolved
-
-
JDK-8078351 JEP-JDK-8062493: [jvmci] Test task: compiler to JVM methods
-
- Resolved
-
-
JDK-8078355 JEP-JDK-8062493: [jvmci] Test task: security restrictions
-
- Resolved
-
-
JDK-8131709 JEP-JDK-8062493: [jvmci] Test task: unit tests
-
- Closed
-
- relates to
-
JDK-8137095 [JVMCI] CompilerToVM method "resolveInvokeDynamicInPool" does not work as expected
-
- Open
-
-
JDK-8133194 CompilerToVM interface lacks java docs
-
- Closed
-
-
JDK-8137021 [JVMCI] CompilerToVM methods "lookupNameRefInPool" and "lookupSignatureRefInPool" cause JVM crash
-
- Closed
-
-
JDK-8137159 [JVMCI] CompilerToVM::getConstantPool method does not work according to javadoc
-
- Closed
-
-
JDK-8144856 fix assert in CompiledStaticCall::set_to_interpreted
-
- Closed
-
-
JDK-8134767 [JVMCI] CompilerToVM.getNextStackFrame loses locals for compiled frames
-
- Closed
-
-
JDK-8137092 [JVMCI] CompilerToVM methods "lookupNameAndTypeRefIndexInPool" and "lookupKlassRefIndexInPool" do not work as expected
-
- Closed
-
-
JDK-8133195 [JVMCI] CompilerToVM::getLocalVariableTableStart and CompilerToVM::getLocalVariableTableLength return 0
-
- Closed
-
-
JDK-8138610 add assert to ThreadLocalAllocBuffer::clear_before_allocation to check the storage above top
-
- Open
-
-
JDK-8139170 JVMCI refresh
-
- Resolved
-
-
JDK-8137083 [JVMCI] CompilerToVM methods "resolveConstantInPool" and "resolvePossiblyCachedConstantInPool" have poor javadoc
-
- Resolved
-
-
JDK-8131705 JEP-JDK-8062493: [jvmci] Test task: port existing jvmci tests
-
- Resolved
-
-
JDK-8131709 JEP-JDK-8062493: [jvmci] Test task: unit tests
-
- Closed
-
-
JDK-8078356 JEP-JDK-8062493: [jvmci] Test task: multiple listeners/providers
-
- Open
-
-
JDK-8078357 JEP-JDK-8062493: [jvmci] Test task: changing passed data
-
- Open
-
-
JDK-8078358 JEP-JDK-8062493: [jvmci] Test task: interaction w/ RT
-
- Open
-
-
JDK-8078359 JEP-JDK-8062493: [jvmci] Test task: interaction w/ GC
-
- Open
-
-
JDK-8078360 JEP-JDK-8062493: [jvmci] Test task: MT tests
-
- Open
-
-
JDK-8078362 JEP-JDK-8062493: [jvmci] Test task: huge method
-
- Open
-
-
JDK-8078363 JEP-JDK-8062493: [jvmci] Test task: interaction w/ Compile Control
-
- Open
-
-
JDK-8131707 JEP-JDK-8062493: [jvmci] Test task: interaction w/ SVC
-
- Open
-
-
JDK-8133016 JEP-JDK-8062493: [jvmci] Test task: complex test cases
-
- Open
-
-
JDK-8133017 JEP-JDK-8062493: [jvmci] Test task: cli tests
-
- Open
-
-
JDK-8136755 JEP-JDK-8062493: [jvmci] Test task: develop tests for untested classes used in CompilerToVM::* methods
-
- Open
-
-
JDK-8137018 [JVMCI] Encapsulate new Thread fields for JVMCI
-
- Open
-
-
JDK-8022853 add ability to load uncompressed object and Klass references in a compressed environment to Unsafe
-
- Resolved
-
1.
|
Integration |
|
Closed | Christian Thalinger (Inactive) |