Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8223220

JVMCI based JIT Compiler pre-compiled as shared library

    Details

    • Author:
      Vladimir Kozlov
    • JEP Type:
      Feature
    • Exposure:
      Open
    • Subcomponent:
    • Scope:
      Implementation
    • Discussion:
      hotspot dash compiler dash dev at openjdk dot java dot net
    • Effort:
      M
    • Duration:
      M

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kvn Vladimir Kozlov
                Reporter:
                kvn Vladimir Kozlov
                Owner:
                Vladimir Kozlov
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated: