Skip to content

Commit cbeae45

Browse files
committed
make use of the "graal." prefix for Graal options an error
1 parent c6fd7c7 commit cbeae45

File tree

7 files changed

+35
-60
lines changed

7 files changed

+35
-60
lines changed

compiler/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
This changelog summarizes newly introduced optimizations and other compiler related changes.
44

5+
## GraalVM for JDK 26 (Internal Version 26.0.0)
6+
* (GR-54646): Using the `graal.` prefix for Graal options is no longer supported and causes an error at startup.
7+
For example:
8+
```
9+
> java -Dgraal.ShowConfiguration=info Hello.java
10+
Error parsing Graal options: The 'graal.' prefix for ShowConfiguration is unsupported - use 'jdk.graal.ShowConfiguration' instead.
11+
Error: A fatal exception has occurred. Program will exit.
12+
```
13+
514
## GraalVM for JDK 25 (Internal Version 25.0.0)
615
* (GR-60088): This PR adds the `org.graalvm.nativeimage.libgraal` SDK module. With this module, all logic for building
716
libgraal has been moved into the compiler suite in a new `jdk.graal.compiler.libgraal` module

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ea/ReadEliminationCodeEmissionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void runTest(String baseName, Object... args) {
117117
"-XX:+PreserveFramePointer",
118118
"-Xbatch",
119119
"-XX:LogFile=" + logName,
120-
"-Dgraal.Dump=:5"};
120+
"-Djdk.graal.Dump=:5"};
121121
}
122122
try {
123123
subprocess = launchSubprocess(run, vmArgs);

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/hotspot/test/HotSpotGraalOptionValuesTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ public void testPrintHelp() throws IOException {
8181
}
8282

8383
@Test
84-
public void testDeprecation() throws IOException, InterruptedException {
84+
public void testLegacyOptionError() throws IOException, InterruptedException {
8585
List<String> vmArgs = withoutDebuggerArguments(getVMCommandLine());
8686
vmArgs.removeIf(a -> a.startsWith("-Djdk.graal."));
8787
vmArgs.add("-Dgraal.ShowConfiguration=info");
88-
vmArgs.add("-Dgraal.PrintCompilation=true");
8988
vmArgs.add("-XX:+EagerJVMCI");
9089
vmArgs.add("--version");
9190
SubprocessUtil.Subprocess proc = SubprocessUtil.java(vmArgs);
9291

93-
String expect = "WARNING: The 'graal.' property prefix for the Graal option";
92+
Assert.assertNotEquals(proc.preserveArgfile().toString(), 0, proc.exitCode);
93+
String expect = "Error parsing Graal options: The 'graal.' prefix for ShowConfiguration is unsupported - use 'jdk.graal.ShowConfiguration' instead.";
9494
long matches = proc.output.stream().filter(line -> line.contains(expect)).count();
9595
if (matches != 1) {
9696
Assert.fail(String.format("Did not find exactly 1 match for '%s' in output of command [matches: %d]:%n%s",

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/HotSpotGraalOptionValues.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,14 @@ public class HotSpotGraalOptionValues {
5959
* {@code GRAAL_OPTION_PROPERTY_PREFIX + "MyOption"}.
6060
*/
6161
public static final String GRAAL_OPTION_PROPERTY_PREFIX = "jdk.graal.";
62-
public static final String LEGACY_GRAAL_OPTION_PROPERTY_PREFIX = "graal.";
62+
63+
private static final String LEGACY_GRAAL_OPTION_PROPERTY_PREFIX = "graal.";
6364

6465
/**
6566
* Prefix for system properties that correspond to libgraal Native Image options.
6667
*/
6768
public static final String LIBGRAAL_VM_OPTION_PROPERTY_PREFIX = "jdk.graal.internal.";
6869

69-
/**
70-
* Guard for issuing warning about deprecated Graal option prefix at most once.
71-
*/
72-
private static final GlobalAtomicLong LEGACY_OPTION_DEPRECATION_WARNED = new GlobalAtomicLong("LEGACY_OPTION_DEPRECATION_WARNED", 0L);
73-
7470
/**
7571
* Gets the system property assignment that would set the current value for a given option.
7672
*/
@@ -114,14 +110,8 @@ public static EconomicMap<OptionKey<?>, Object> parseOptions() {
114110
String name = e.getKey();
115111
if (name.startsWith(LEGACY_GRAAL_OPTION_PROPERTY_PREFIX)) {
116112
String baseName = name.substring(LEGACY_GRAAL_OPTION_PROPERTY_PREFIX.length());
117-
name = GRAAL_OPTION_PROPERTY_PREFIX + baseName;
118-
if (LEGACY_OPTION_DEPRECATION_WARNED.compareAndSet(0L, 1L)) {
119-
System.err.printf("""
120-
WARNING: The 'graal.' property prefix for the Graal option %s
121-
WARNING: (and all other Graal options) is deprecated and will be ignored
122-
WARNING: in a future release. Please use 'jdk.graal.%s' instead.%n""",
123-
baseName, baseName);
124-
}
113+
String msg = String.format("The 'graal.' prefix for %s is unsupported - use 'jdk.graal.%s' instead.", baseName, baseName);
114+
throw new IllegalArgumentException(msg);
125115
}
126116
if (name.startsWith(GRAAL_OPTION_PROPERTY_PREFIX)) {
127117
if (name.startsWith(LIBGRAAL_VM_OPTION_PROPERTY_PREFIX)) {

espresso/src/com.oracle.truffle.espresso.libjavavm/src/com/oracle/truffle/espresso/libjavavm/arghelper/Native.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class Native {
4545
private final ArgumentsHandler handler;
4646

4747
private String argPrefix;
48-
private boolean legacyGraalOptionDeprecationWarned = false;
4948

5049
void init(boolean fromXXHandling) {
5150
argPrefix = fromXXHandling ? "-" : "--vm.";
@@ -56,14 +55,7 @@ void setNativeOption(String arg) {
5655
setGraalStyleRuntimeOption(arg.substring("Djdk.graal.".length()));
5756
} else if (arg.startsWith("Dgraal.")) {
5857
String baseName = arg.substring("Dgraal.".length());
59-
if (!legacyGraalOptionDeprecationWarned) {
60-
warn("""
61-
WARNING: The 'graal.' property prefix for the Graal option %s
62-
WARNING: (and all other Graal options) is deprecated and will be ignored
63-
WARNING: in a future release. Please use 'jdk.graal.%s' instead.""".formatted(baseName, baseName));
64-
legacyGraalOptionDeprecationWarned = true;
65-
}
66-
setGraalStyleRuntimeOption(baseName);
58+
throw abort("The 'graal.' prefix for " + baseName + " is unsupported - use 'jdk.graal." + baseName + "' instead.");
6759
} else if (arg.startsWith("D")) {
6860
setSystemProperty(arg.substring("D".length()));
6961
} else if (arg.startsWith("XX:")) {

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/option/RuntimeOptionParser.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ public final class RuntimeOptionParser implements DuplicableImageSingleton {
7676
*/
7777
private static final String LEGACY_GRAAL_OPTION_PREFIX = "-Dgraal.";
7878

79-
/**
80-
* Guard for issuing warning about deprecated Graal option prefix at most once.
81-
*/
82-
private static final AtomicBoolean LEGACY_OPTION_DEPRECATION_WARNED = new AtomicBoolean();
83-
8479
/**
8580
* The prefix for XOptions available in an application based on Substrate VM.
8681
*/
@@ -153,15 +148,8 @@ public String[] parse(String[] args, String normalOptionPrefix, String graalOpti
153148
parseOptionAtRuntime(arg, graalOptionPrefix, BooleanOptionFormat.NAME_VALUE, values, ignoreUnrecognized);
154149
} else if (legacyGraalOptionPrefix != null && arg.startsWith(legacyGraalOptionPrefix)) {
155150
String baseName = arg.substring(legacyGraalOptionPrefix.length());
156-
if (LEGACY_OPTION_DEPRECATION_WARNED.compareAndExchange(false, true)) {
157-
Log log = Log.log();
158-
// Checkstyle: Allow raw info or warning printing - begin
159-
log.string("WARNING: The 'graal.' property prefix for the Graal option ").string(baseName).newline();
160-
log.string("WARNING: (and all other Graal options) is deprecated and will be ignored").newline();
161-
log.string("WARNING: in a future release. Please use 'jdk.graal.").string(baseName).string("' instead.").newline();
162-
// Checkstyle: Allow raw info or warning printing - end
163-
}
164-
parseOptionAtRuntime(arg, legacyGraalOptionPrefix, BooleanOptionFormat.NAME_VALUE, values, ignoreUnrecognized);
151+
String msg = String.format("The 'graal.' prefix for %s is unsupported - use 'jdk.graal.%s' instead.", baseName, baseName);
152+
throw new IllegalArgumentException(msg);
165153
} else if (xOptionPrefix != null && arg.startsWith(xOptionPrefix) && XOptions.parse(arg.substring(xOptionPrefix.length()), values)) {
166154
// option value was already parsed and added to the map
167155
} else {

vm/mx.vm/mx_vm_gate.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,24 @@ def extra_check(compiler_log):
186186
table = f' Count Stub{nl} ' + f'{nl} '.join((f'{count:<8d} {stub}') for stub, count in stub_compilations.items())
187187
mx.abort(f'Following stubs were compiled more than once according to compiler log:{nl}{table}')
188188

189-
# Test that legacy `-D.graal` options work.
190-
show_config_args = ('-Djdk.graal.ShowConfiguration=verbose', '-Dgraal.ShowConfiguration=verbose')
189+
args = check_stub_sharing + ['-Djdk.graal.ShowConfiguration=verbose'] + _get_CountUppercase_vmargs()
191190

192-
for show_config_arg in show_config_args:
193-
args = check_stub_sharing + [show_config_arg] + _get_CountUppercase_vmargs()
194-
195-
# Verify execution via raw java launcher in `mx graalvm-home`.
196-
for jre_name, jre, jre_args in jres:
197-
try:
198-
cmd = [join(jre, 'bin', 'java')] + jre_args + extra_vm_arguments + args
199-
mx.log(f'{jre_name}: {" ".join(cmd)}')
200-
mx.run(cmd)
201-
finally:
202-
_check_compiler_log(compiler_log_file, expect, extra_check=extra_check)
203-
204-
# Verify execution via `mx vm`.
205-
import mx_compiler
191+
# Verify execution via raw java launcher in `mx graalvm-home`.
192+
for jre_name, jre, jre_args in jres:
206193
try:
207-
mx.log(f'mx.run_vm: args={extra_vm_arguments + args}')
208-
mx_compiler.run_vm(extra_vm_arguments + args)
194+
cmd = [join(jre, 'bin', 'java')] + jre_args + extra_vm_arguments + args
195+
mx.log(f'{jre_name}: {" ".join(cmd)}')
196+
mx.run(cmd)
209197
finally:
210-
_check_compiler_log(compiler_log_file, expect)
198+
_check_compiler_log(compiler_log_file, expect, extra_check=extra_check)
199+
200+
# Verify execution via `mx vm`.
201+
import mx_compiler
202+
try:
203+
mx.log(f'mx.run_vm: args={extra_vm_arguments + args}')
204+
mx_compiler.run_vm(extra_vm_arguments + args)
205+
finally:
206+
_check_compiler_log(compiler_log_file, expect)
211207

212208
def _test_libgraal_fatal_error_handling(extra_vm_arguments):
213209
"""

0 commit comments

Comments
 (0)