-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8309136: [JVMCI] add -XX:+UseGraalJIT flag #14231
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
Changes from all commits
f9b3538
235075c
2d1a1e9
430b7a5
578b753
60370c5
28f0a8b
bcbab07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. | ||
| * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
|
|
@@ -50,6 +50,14 @@ static class Expectation { | |
| } | ||
|
|
||
| public static void main(String[] args) throws Exception { | ||
| if (args.length != 0) { | ||
| // Called as subprocess. Print system properties named by | ||
| // `args` and then exit. | ||
| for (String arg : args) { | ||
| System.out.printf("%s=%s%n", arg, System.getProperty(arg)); | ||
| } | ||
| return; | ||
| } | ||
| // Test EnableJVMCIProduct without any other explicit JVMCI option | ||
| test("-XX:-PrintWarnings", | ||
| new Expectation("EnableJVMCI", "true", "default"), | ||
|
|
@@ -67,24 +75,33 @@ public static void main(String[] args) throws Exception { | |
| new Expectation("EnableJVMCI", "false", "command line"), | ||
| new Expectation("UseJVMCICompiler", "false", "default")); | ||
| test("-XX:+EnableJVMCIProduct", | ||
| new Expectation("EnableJVMCIProduct", "true", "command line"), | ||
| new Expectation("EnableJVMCIProduct", "true", "(?:command line|jimage)"), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What "(?:command line|jimage)" means? Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a standard Java regular expression and it means the value is expected have been set on the command line or by the VM options read from the jimage (see JDK-8232080). |
||
| new Expectation("EnableJVMCI", "true", "default"), | ||
| new Expectation("UseJVMCICompiler", "true", "default")); | ||
| } | ||
|
|
||
| static void test(String explicitFlag, Expectation... expectations) throws Exception { | ||
| ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( | ||
| "-XX:+UnlockExperimentalVMOptions", "-XX:+EnableJVMCIProduct", "-XX:-UnlockExperimentalVMOptions", | ||
| explicitFlag, | ||
| "-XX:+PrintFlagsFinal", "-version"); | ||
| OutputAnalyzer output = new OutputAnalyzer(pb.start()); | ||
| for (Expectation expectation : expectations) { | ||
| output.stdoutShouldMatch(expectation.pattern); | ||
| } | ||
| if (output.getExitValue() != 0) { | ||
| // This should only happen when JVMCI compilation is requested and the VM has no | ||
| // JVMCI compiler (e.g. Graal is not included in the build) | ||
| output.stdoutShouldMatch("No JVMCI compiler found"); | ||
| String[] flags = {"-XX:+EnableJVMCIProduct", "-XX:+UseGraalJIT"}; | ||
| String cwd = System.getProperty("user.dir"); | ||
| for (String flag : flags) { | ||
| ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( | ||
| "-XX:+UnlockExperimentalVMOptions", flag, "-XX:-UnlockExperimentalVMOptions", | ||
| explicitFlag, | ||
| "-XX:+PrintFlagsFinal", | ||
| "--class-path=" + System.getProperty("java.class.path"), | ||
| "TestEnableJVMCIProduct", "jvmci.Compiler"); | ||
| OutputAnalyzer output = new OutputAnalyzer(pb.start()); | ||
| for (Expectation expectation : expectations) { | ||
| output.stdoutShouldMatch(expectation.pattern); | ||
| } | ||
| if (flag.equals("-XX:+UseGraalJIT")) { | ||
| output.shouldContain("jvmci.Compiler=graal"); | ||
| } | ||
| if (output.getExitValue() != 0) { | ||
| // This should only happen when JVMCI compilation is requested and the VM has no | ||
| // JVMCI compiler (e.g. Graal is not included in the build) | ||
| output.stdoutShouldMatch("No JVMCI compiler found"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
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.
Why this restriction? Usually latest specified flag wins. May be comment with explanation.
Also you did not check for
if (UseGraalJIT).What about the case
-XX:+EnableJVMCIProduct -XX:-UseGraalJIT?I would expect this kind of checks done in
JVMCIGlobals::check_jvmci_flags_are_consistent()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.
This is a pre-existing restriction on
EnableJVMCIProductand sinceUseGraalJITis an alias forEnableJVMCIProduct, it must abide by the same restrictions. For whatever reason, the effect of+EnableJVMCIProductcannot be undone and so the same must hold for+UseGraalJIT.This check is not necessary as
UseGraalJITis an alias. WhenEnableJVMCIProductis set to true,UseGraalJITwill also be set to true. Stating this now, I see that I missed it: 430b7a5That results in:
which is what is expected.