RFR: 8345826: Do not automatically resolve jdk.internal.vm.ci when libgraal is used
Tom Rodriguez
never at openjdk.org
Thu May 15 21:54:18 UTC 2025
On Wed, 14 May 2025 22:00:30 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
> The `EnableJVMCI` flag currently serves 2 purposes:
> * Guards VM code ([example](https://github.com/openjdk/jdk/blob/b1e778d9d2ad13ee5f1ed629a8805008580f86c0/src/hotspot/share/runtime/sharedRuntime.cpp#L652)).
> * [Adds](https://github.com/openjdk/jdk/blob/b1e778d9d2ad13ee5f1ed629a8805008580f86c0/src/hotspot/share/runtime/arguments.cpp#L1804) `jdk.internal.vm.ci` to the root module set.
>
> This PR changes nothing about the first point.
>
> On the second point, to use the `jdk.internal.vm.ci` module, it must now be explicitly added with `--add-modules=jdk.internal.vm.ci`, which will also set `EnableJVMCI` as a side-effect.
>
> The primary motivation is to make use of libgraal compatible with `-XX:+AOTClassLinking`. This flag relies on an archive of the root module set created in a separate JVM execution. If the root module set is different than what's in the archive at runtime, the AOTClassLinking [optimizations](https://bugs.openjdk.org/browse/JDK-8342279) are disabled. As `jdk.internal.vm.ci` is not resolved when creating the archive, it must not be resolved in the runtime using the archive. As such, `-XX:+EnableJVMCI` must not cause resolution of `jdk.internal.vm.ci` for libgraal to have the startup advantages of AOTClassLinking.
I found your explanation quite confusing, but the bug title is actually the most clear description of the fix. Basically libjvmci doesn't require the existence of jdk.internal.vm.ci on the HotSpot side since it has effectively compiled that into itself. So we are decoupling the ability to use JVMCI from the presence of the JVMCI module. A short comment along these lines in at least your changes in check_vm_args_consistency would be helpful I think.
I do find it confusing that we are explicitly passing `--add-modules=jdk.internal.vm.ci` in a bunch of the tests. Is that now necessary or are you just exercising the alternate ways of enabling JVMCI?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25240#issuecomment-2884370108
More information about the graal-dev
mailing list