-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8345826: [DO NOT MERGE] Do not automatically resolve jdk.internal.vm.ci when libgraal is used #23408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back dnsimon! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
dbfac0f
to
d43bdd6
Compare
@dougxc This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@dougxc this pull request can not be integrated into git checkout ds/remove-EnableJVMCI-flag
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
d43bdd6
to
c4f083c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you done any benchmarking? Since the unconditionally enabled code are only in i2c adapters and deopt entries, the impact should be minimal?
src/hotspot/share/code/nmethod.cpp
Outdated
@@ -1225,6 +1225,9 @@ nmethod* nmethod::new_nmethod(const methodHandle& method, | |||
DEBUG_ONLY(nm->verify();) | |||
nm->log_new_nmethod(); | |||
} | |||
#if INCLUDE_JVMCI | |||
JVMCI::installed_code(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JVMCI::set_has_installed_code()
would be clearer.
if (status && UseJVMCICompiler && FLAG_IS_DEFAULT(UseJVMCINativeLibrary) && !UseJVMCINativeLibrary) { | ||
if (!JVMCI::shared_library_exists() && ClassLoader::is_module_observable("jdk.internal.vm.ci")) { | ||
// If no JVMCI native library is present, | ||
// we enable the JVMCI module by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the comment should explain who uses the JVMCI module? Is it used by jar graal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I see that you have modified the tests to say --add-modules=jdk.internal.vm.ci -XX:+UseJVMCICompiler
. Shouldn't we leave the responsibility to the user for adding the module, and avoid hard-coding this into HotSpot?
} else if (match_option(option, "-XX:+EnableJVMCI")) { | ||
jio_fprintf(defaultStream::error_stream(), | ||
"-XX:+EnableJVMCI was removed in JDK 25. Use --add-modules=jdk.internal.vm.ci to make use of the JVMCI module.\n"); | ||
return JNI_EINVAL; | ||
} else if (match_option(option, "-XX:-EnableJVMCI")) { | ||
jio_fprintf(defaultStream::error_stream(), | ||
"-XX:-EnableJVMCI was removed in JDK 25.\n"); | ||
return JNI_EINVAL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since EnableJVMCI
is an experimental flag, it should be removed by the "2 step" model. It should be entered in special_jvm_flags[]
in arguments.cpp as obsoleted in JDK 25.
jdk/src/hotspot/share/runtime/arguments.cpp
Lines 483 to 484 in 7bde2bb
* To remove internal options (e.g. diagnostic, experimental, develop options), use | |
* a 2-step model adding major release numbers to the obsolete and expire columns. |
@@ -30,7 +30,6 @@ | |||
* @test id=static | |||
* @requires vm.cds.supports.aot.class.linking | |||
* @comment work around JDK-8345635 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The * @comment work around JDK-8345635
lines should also be removed from all the CDS tests.
Is it possible to limit the scope of the HotSpot changes by simply removing the addition of the |
This means Truffle users will need to add |
@iklam based on your comment here, adding JVMCI to the AOT cache is visible from an application perspective. For example, |
AOT doesn't keep track of how a resource (e.g., a classfile) is loaded. It relies on the module system to only provide the classfiles that are visible when the AOT cache is being assembled. So it will take a lot of effort to implement what you are suggesting. Anyway, I think the fundamental problem is libgraal doesn't need jdk.internal.vm.ci, but it makes it available anyway. As a result, real Java programs that need jdk.internal.vm.ci will be able to use it without asking properly (either by declaring in Therefore, I don't think it's a good idea for the AOT cache to try to support a behavior that's in itself not correct. The right thing to do is to remove the unnecessary module addition in arguments.cpp, and change the Java apps so they ask for the modules that they depend on. |
This will be breaking for Truffle users who currently rely on EnableJVMCI to enable both the I think it would be alright if we also enable native JVMCI with So options: |
Depends on what you mean by properly. Since
Under both these options, running jargraal will now require |
B seems doable (some parsing will be required in arguments.cpp: if I've looked at the options inside jvmci_globals.hpp and it's hard to understand what each option is used for. As a result, I don't know what impact we have for all the options we discussed. Before we decide on an action plan, can we first make a table that list all the uses cases, and the requirements for each case. E.g.,
Also, how does one use jargraal or Truffle? Any example? Are these possible with the Oracle JDK, or do you need GraalVM for JDK? |
Good idea. Here's the current situation:
Under proposal A (i.e. introduce EnableJVMCINative):
Under proposal B (i.e. EnableJVMCI enables native JVMCI and
Note: |
For Proposal A, I think we should have this for the 4th row:
Since both proposal A and B would require changes for Truffle users (which is not unreasonable because EnableJVMCI is an experimental flag, subject to change), I think it's better to go with B, where each party declare its own dependencies:
However, B would require more changes in the test cases. Some of the |
You're right - I fixed it in situ.
Sounds reasonable to me. Once @chumer signs off on B, I'll start to look at implementing it.
I think we're always going to need |
I think B is alright. One issue is that users who switch between JDK versions need to use both old and new ways of configuring truffle, at least in the time between when we still support both JDK versions. But I think multi-JDK-version users should be fine if they set both |
yes |
I've pushed a commit for Proposal B. I still need to figure out how to deal with the fact that jtreg puts |
The options I see are:
index 5d23b03996f..40a2c75ef9f 100644
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -2255,7 +2255,10 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, JVMFlagOrigin
char after = *(jvmci_module + strlen("jdk.internal.vm.ci"));
if ((before == '=' || before == ',') && (after == '\0' || after == ',')) {
if (!_jvmci_module_added) {
+ bool unlock_state = UnlockExperimentalVMOptions;
+ UnlockExperimentalVMOptions = true;
bool valid = process_argument("+EnableJVMCI", args->ignoreUnrecognized, origin);
+ UnlockExperimentalVMOptions = unlock_state;
if (!valid) {
jio_fprintf(defaultStream::error_stream(),
"'EnableJVMCI' implied by jdk.internal.vm.ci module in '%s'\n", option->optionString); Are there other options I'm missing @iklam ? |
5cf594f
to
f088f6e
Compare
f088f6e
to
2bc72fb
Compare
Closing this PR in favor of #25240. |
JVMCI is currently incompatible with
-XX:+AOTClassLinking
as the CDS optimizations under this flag require use of the CDS archived module graph. Since-XX:+EnableJVMCI
extends the default root module set, the CDS archived module graph is disabled. This will result in slower start-up time when-XX:+UseGraalJIT
is enabled (since-XX:+UseGraalJIT
implies-XX:+EnableJVMCI
).A work-around suggested by @iklam is to run with "-Xshare:dump --add-modules=jdk.internal.vm.ci -XX:+AOTClassLinking", but then the resulting CDS archive cannot be used when UseGraalJIT is disabled.
The
EnableJVMCI
flag serves 2 purposes: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 setEnableJVMCI
as a side-effect.Replaced by #25240
Replaces #23289.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23408/head:pull/23408
$ git checkout pull/23408
Update a local copy of the PR:
$ git checkout pull/23408
$ git pull https://git.openjdk.org/jdk.git pull/23408/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23408
View PR using the GUI difftool:
$ git pr show -t 23408
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23408.diff