JDK-8220623 : [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-03-13
  • Updated: 2024-06-10
  • Resolved: 2019-05-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b19Fixed
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Java based VM compiler interface (JVMCI), JEP-243 should support JVMCI based Just-In-Time Compiler (such as Graal) which is Ahead-Of-Time compiled into a native shared library.
Comments
Here is list of JVMCI changes from graal-jvmci-8 repository integrated with these changes: a53131e Thu Apr 18 06:37:08 2019 -0700 Doug Simon [GR-15272] Update the nmethod mirror slot before notifying the GC. fa133f2 Mon Apr 1 14:40:12 2019 -0700 Doug Simon [GR-14881] Adjust stack size for JVMCI shared library compiler threads. 54b534d Mon Apr 1 05:00:23 2019 -0700 Doug Simon [GR-14755] Misc fixes for registerNativeMethods. f966e01 Fri Mar 29 10:41:28 2019 -0700 Doug Simon [GR-14836] Only treat JVMCI threads in native library as user threads. c39a28f Wed Mar 27 08:50:06 2019 -0700 Vladimir Kozlov [GR-14747] NPE in HotSpotMemoryAccessProviderImpl.readNarrowOopConstant(). eb820be Mon Mar 25 20:33:08 2019 -0700 Tom Rodriguez [GR-14677] CompilerToVM.isInternedString is missing check for String. 237d36c Fri Mar 22 03:10:13 2019 -0700 Doug Simon Merge pull request #155 in G/graal-jvmci-8 from ds/GR-14652 to master efa4fc4 Wed Mar 20 09:51:49 2019 -0700 Doug Simon [GR-13902] Replace adjustCompilationLevel mechanism. 578d30f4c5 Mon Mar 18 16:49:57 2019 -0700 Doug Simon [GR-14526] Replace JVMCINMethodData constructor and operator new with initialize. b12ec330c9 Mon Mar 18 15:47:12 2019 -0700 Doug Simon [GR-14509] Fixed order of method mirror invalidation. 2d431bdcea Thu Mar 14 06:22:30 2019 -0700 Doug Simon [GR-14475] Fixed support for jvmci.InitTimer. 4c54936 Wed Mar 13 12:40:07 2019 -0700 Doug Simon [GR-14105] Remove uses of system properties. 54c71b8 Mon Mar 11 09:05:05 2019 -0700 Doug Simon [GR-13605] [GR-14195] Unify format of Graal options on command line. d6c6fc4 Mon Mar 11 00:52:43 2019 -0700 Doug Simon [GR-14359] Change TraceClassLoadingStack to TraceClassLoadingCause. e80bd6e Sat Mar 9 09:25:50 2019 -0800 Doug Simon [GR-14361] Only exit VM only on unrecoverable exceptions in JVMCI. 2a5abbb Sat Mar 9 07:11:54 2019 -0800 Doug Simon [GR-14359] Re-add TraceClassLoadingStack flag. de14dbc Wed Mar 6 10:17:53 2019 -0800 Tom Rodriguez [GR-14268] Revert some flag defaults for libgraal. 021ad2d Tue Mar 5 22:18:51 2019 -0800 Tom Rodriguez [GR-14278] Minor JVMCI fixes. 3e4efe9 Tue Mar 5 02:27:56 2019 -0800 Gilles Duboscq [GR-14244] Add missing type in `vmStructs_jvmci`. 15c5be2 Mon Mar 4 09:47:03 2019 -0800 Doug Simon [GR-14229] Reserve oops table slot for non-default HotSpotNmethod compiled by libgraal and fix its translation to HotSpot heap. 54e5821 Sun Mar 3 02:57:04 2019 -0800 Doug Simon [GR-14207] Fix default implementation of hasBytecodes. 329e0fe469 Thu Feb 28 22:12:46 2019 -0800 Tom Rodriguez [GR-14043] Use Handle with asConstant. dac10c4d32 Thu Feb 28 12:47:20 2019 -0800 Doug Simon [GR-14184] Avoid unnecessary allocation when validating speculations. 991f0d54c6 Thu Feb 28 06:43:12 2019 -0800 Doug Simon [GR-13955] Put HotSpotNmethod mirror into nmethod oops table. fcfaf4390d Wed Feb 27 09:07:33 2019 -0800 Doug Simon [GR-14147] Fixed lazy collection of failed speculations. 932717efd9 Tue Feb 26 23:30:15 2019 -0800 Tom Rodriguez [GR-14106] Properly create byte[][]. 4dead15062 Thu Feb 21 23:58:13 2019 -0800 Doug Simon [GR-14040] Be more careful about primitive types in boxing objects. 3952d75b3f Wed Feb 20 01:03:05 2019 -0800 Doug Simon [GR-13950] Extended HotSpotVMConfigAccess API to query C++ field types. aa441a3e4a Tue Feb 19 17:31:17 2019 -0800 Vladimir Kozlov [GR-13933] Fix build errors. 2045f8b262 Mon Feb 18 09:10:52 2019 -0800 Doug Simon [GR-13685] Serialize HotSpot speculations. 5de0fc4d01 Mon Feb 18 02:17:22 2019 -0800 Doug Simon [GR-13844] Implement HotSpotObjectConstantImpl.hashCode properly. 6f574a4 Wed Feb 6 10:26:59 2019 -0800 Tom Rodriguez [GR-13746] JVMCI fastdebug fixes. fd3725b Tue Jan 22 09:44:22 2019 -0800 Doug Simon [GR-13408] Free C allocated compilation failure message. e2352cf Mon Jan 21 13:47:47 2019 -0800 Doug Simon [GR-13412] Must only initialize JVMCIClassLoaderFactory from the VM. 145ecfd Fri Jan 18 12:23:46 2019 -0800 Doug Simon [GR-13374] Expose some JVMTI capabilities via JVMCI. 2a2b955 Mon Jan 14 13:53:00 2019 -0800 Doug Simon [GR-13330] Add workaround for resolving Object.clone against an array type. ec9ffdf Sun Jan 13 04:32:32 2019 -0800 Doug Simon [GR-13308] Support use of JVMCI class loader when using JVMCI shared library. 0f60364 Sat Jan 12 04:18:18 2019 -0800 Doug Simon [GR-13307] Replace JVMCIJavaMode with boolean JVMCIUseSharedLib flag. 2987242 Mon Dec 17 19:25:29 2018 -0800 Doug Simon [GR-12528] Remove HotSpotJVMCIMetaAccessContext. b7efc89 Mon Dec 17 17:33:09 2018 -0800 Doug Simon [GR-13066] Push/pop local JNI frame for top-level call into JVMCI shared library. c7187b9 Fri Dec 14 06:46:12 2018 -0800 Doug Simon [GR-13075] Use VM call to determine if a type can have its methods intrinsified. 5b40948 Wed Nov 21 11:11:10 2018 -0800 Tom Rodriguez [GR-12454] Use handles when building StackTraceElement. 47d963c Tue Nov 20 01:02:09 2018 -0800 Doug Simon [GR-12542] Avoid creating unnecessary Field and Method objects. 3470d4c Fri Nov 16 09:36:22 2018 -0800 Doug Simon [GR-12579] Do not create Method for <clinit>. 8c049c4 Thu Nov 15 12:15:02 2018 -0800 Doug Simon [GR-12542] Use CompilerToVM to convert JVMCI objects to reflection objects. e6ea2c6 Wed Nov 14 04:33:42 2018 -0800 Doug Simon [GR-12496] Address JVMCI performance issues. ed5ac62 Fri Nov 9 10:49:40 2018 -0800 Tomáš Zezula [GR-12460] RegisterNativeMethods should not require use of Unsafe on returned value. 7e2338c Wed Nov 7 02:29:05 2018 -0800 Aleksandar Pejovic [GR-11747] Check for spaces in MKS_HOME when building JVMCI. 49ff204 Mon Nov 5 12:25:14 2018 -0800 Tom Rodriguez [GR-5926] JVMCI support for libgraal.
02-05-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/ad45b3802d4e User: kvn Date: 2019-05-01 19:31:49 +0000
01-05-2019

Delta 1 is mostly JVMCI HotSpot refactoring and cleanup: http://cr.openjdk.java.net/~kvn/8220623/webrev_delta1.07/ - Cleanup #include jvmci files. - Removed BoolObjectClosure parameter from JVMCI::do_unloading() since it is not used. In JDK 13 this parameter is removed from other places too. - Added mtJVMCI type to track memory used by JVMCI. - Passed Handles as constant references. - Moved JNIAccessMark, JVMCIObject, MetadataHandleBlock class to separate new files. - Moved JVMCI methods bodies from jvmciRuntime.cpp into new jvmci.cpp file. - Moved bodies of some JVMCIEnv methods from .hpp into jvmciEnv.cpp file. They use JNIAccessMark and ThreadToNativeFromVM and I can't use them in header file because they require #include inline.hpp files. - Moved bodies of some HotSpotJVMCI methods into jvmciJavaClasses.cpp file because, again, they need jniHandles.inline.hpp. - Moved JVMCICompileState class definition to the beginning of jvmciEnv.hpp file. Delta 2: http://cr.openjdk.java.net/~kvn/8220623/webrev_delta2.07/ - Changed MetadataHandleBlock fields which are used only by one instance to static. - Renamed field _jmetadata::_handle to _value and corresponding access methods because it was confusing: handle->handle(). - Switched from JNIHandleBlock to OopStorage use for _object_handles. - Additional JVMCI Java side fix for libgraal. full: http://cr.openjdk.java.net/~kvn/8220623/webrev.07/
01-05-2019

New update based on reviews. - Moved JVMCI::oops_do() to places where it should be called - Moved JVMCI metadata cleanup task to the beginning of ParallelCleaningTask::work - Use JVMCI_ONLY macro with COMMA - Disable JVMCI build on SPARC. We don't use it there (neither Graal or AOT are built on SPARC). It also helps to find that all JVMCI guards are present. http://cr.openjdk.java.net/~kvn/8220623/webrev_delta.06/ New full: http://cr.openjdk.java.net/~kvn/8220623/webrev.06/
04-04-2019

Additional changes based on reviews: - For G1 moved JVMCI::do_unloading() call to ParallelCleaningTask to execute by one worker thread. - Added #if INCLUDE_JVMCI for code which is used only by JVMCI. - Used JVMCI_ONLY() macro for one line JVMCI code. - Fixed JVMCI code which count compiler threads in vmOperations.cpp as discussed. - Fixed typo in CompilerThreadStackSize setting in libgraal case. http://cr.openjdk.java.net/~kvn/8220623/webrev_delta.04/
02-04-2019

Additional changes (includes delta.04): - use CompilerThreadStackSize * 2 for libgraal instead of exact value - removed HandleMark added for debugging (reverted changes in jvmtiImpl.cpp) - added recent jvmci-8 changes [GR-14755] to fix registration of native methods in libgraal (jvmciCompilerToVM.cpp) http://cr.openjdk.java.net/~kvn/8220623/webrev_delta.05/
02-04-2019

Added fix [GR-14747] NPE in HotSpotMemoryAccessProviderImpl.readNarrowOopConstant(). http://cr.openjdk.java.net/~kvn/8220623/webrev.03/
28-03-2019

We found several Graal failures in tier8-graal testing (run Graal with -Xcomp). But they are present without these changes too.
28-03-2019

Removed one HandleMark in compileBroker.cpp and added missing JVMCI::do_unloading() call to G1 code: http://cr.openjdk.java.net/~kvn/8220623/webrev.02/
25-03-2019

Did some cleanup, updated copyright year, reverted debug changes. And then applied patch to latest jdk/jdk: http://cr.openjdk.java.net/~kvn/8220623/webrev.01/
24-03-2019

http://cr.openjdk.java.net/~kvn/8220623/webrev.00/ Testing tier1-tier8 did not find any new failures.
24-03-2019

Lab's jvmci-8 version was updated recently to support generation of Graal native shared library: https://github.com/graalvm/graal-jvmci-8 Those changes were ported to latest JDK and pushed into Metropolis repo: JDK-8218847. Additional changes was done to jvmci-8 which will be ported too: JDK-8219995 and JDK-8221280. We need to push these changes into OpenJDK to support libgraal and to have the same JVMCI in all repositories to simplify future JVMCI and Graal development.
23-03-2019

Aarch64 build failure is fixed by JDK-8221354.
23-03-2019

It should be possible to deploy JVMCI based compiler (such as Graal) as an AOT compiled shared library. This can offers benefits including: fast startup compile time similar to native compilers memory usage disjoint from the application Java heap no profile pollution of JDK code used by the application One means of achieving this is to produce 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 AOT 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.
13-03-2019