mirror of https://github.com/oracle/graal.git
compiler: issue deprecation warning for "[lib]graal." property prefix
This commit is contained in:
parent
4de543bf1d
commit
c71689a8e5
|
@ -2,6 +2,10 @@
|
|||
|
||||
This changelog summarizes newly introduced optimizations and other compiler related changes.
|
||||
|
||||
## GraalVM for JDK 24 (Internal Version 24.2.0)
|
||||
* (GR-54476): Issue a deprecation warning on first use of a legacy `graal.` prefix (see GR-49960 below).
|
||||
The warning is planned to be replaced by an error in GraalVM for JDK 25.
|
||||
|
||||
## GraalVM for JDK 23 (Internal Version 24.1.0)
|
||||
* (GR-50352): Added `-Djdk.graal.PrintPropertiesAll` to make `-XX:+JVMCIPrintProperties` show all Graal options.
|
||||
* (GR-25968): New optimization for reducing code size on AMD64, by emitting smaller jump instructions if the displacement fits in one byte.
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.io.IOException;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import jdk.graal.compiler.serviceprovider.GlobalAtomicLong;
|
||||
import org.graalvm.collections.EconomicMap;
|
||||
import jdk.graal.compiler.options.Option;
|
||||
import jdk.graal.compiler.options.OptionDescriptors;
|
||||
|
@ -62,6 +63,17 @@ public class HotSpotGraalOptionValues {
|
|||
public static final String GRAAL_OPTION_PROPERTY_PREFIX = "jdk.graal.";
|
||||
public static final String LEGACY_GRAAL_OPTION_PROPERTY_PREFIX = "graal.";
|
||||
|
||||
/**
|
||||
* Guard for issuing warning about deprecated Graal option prefix at most once.
|
||||
*/
|
||||
private static final GlobalAtomicLong LEGACY_OPTION_DEPRECATION_WARNED = new GlobalAtomicLong(0L);
|
||||
|
||||
/**
|
||||
* Guard for issuing warning about deprecated {@code jdk.graal.options.file} option at most
|
||||
* once.
|
||||
*/
|
||||
private static final GlobalAtomicLong GRAAL_OPTIONS_FILE_DEPRECATION_WARNED = new GlobalAtomicLong(0L);
|
||||
|
||||
/**
|
||||
* Gets the system property assignment that would set the current value for a given option.
|
||||
*/
|
||||
|
@ -102,6 +114,9 @@ public class HotSpotGraalOptionValues {
|
|||
String optionsFile = savedProps.get(GRAAL_OPTIONS_FILE_PROPERTY_NAME);
|
||||
|
||||
if (optionsFile != null) {
|
||||
if (GRAAL_OPTIONS_FILE_DEPRECATION_WARNED.compareAndSet(0L, 1L)) {
|
||||
System.err.println("WARNING: The jdk.graal.options.file property is deprecated and will be ignored in a future release");
|
||||
}
|
||||
File graalOptions = new File(optionsFile);
|
||||
if (graalOptions.exists()) {
|
||||
try (FileReader fr = new FileReader(graalOptions)) {
|
||||
|
@ -126,7 +141,15 @@ public class HotSpotGraalOptionValues {
|
|||
for (Map.Entry<String, String> e : savedProps.entrySet()) {
|
||||
String name = e.getKey();
|
||||
if (name.startsWith(LEGACY_GRAAL_OPTION_PROPERTY_PREFIX)) {
|
||||
name = GRAAL_OPTION_PROPERTY_PREFIX + name.substring(LEGACY_GRAAL_OPTION_PROPERTY_PREFIX.length());
|
||||
String baseName = name.substring(LEGACY_GRAAL_OPTION_PROPERTY_PREFIX.length());
|
||||
name = GRAAL_OPTION_PROPERTY_PREFIX + baseName;
|
||||
if (LEGACY_OPTION_DEPRECATION_WARNED.compareAndSet(0L, 1L)) {
|
||||
System.err.printf("""
|
||||
WARNING: The 'graal.' property prefix for the Graal option %s
|
||||
WARNING: (and all other Graal options) is deprecated and will be ignored
|
||||
WARNING: in a future release. Please use 'jdk.graal.%s' instead.%n""",
|
||||
baseName, baseName);
|
||||
}
|
||||
}
|
||||
if (name.startsWith(GRAAL_OPTION_PROPERTY_PREFIX)) {
|
||||
if (name.equals(GRAAL_OPTIONS_FILE_PROPERTY_NAME)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"README": "This file contains definitions that are useful for the jsonnet CI files of the graal and graal-enterprise repositories.",
|
||||
"ci": {
|
||||
"overlay": "0fb9c2f58b07cc9b370baf3d6f5230aadb0aaf9a"
|
||||
"overlay": "fd337950b64d7e556da5e80f42e5a934a4676021"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -850,6 +850,11 @@ final class HotSpotGraalOptionValuesUtil {
|
|||
private static final String LIBGRAAL_PREFIX = "jdk.libgraal.";
|
||||
private static final String LIBGRAAL_XOPTION_PREFIX = "jdk.libgraal.X";
|
||||
|
||||
/**
|
||||
* Guard for issuing warning about deprecated Graal option prefix at most once.
|
||||
*/
|
||||
private static final GlobalAtomicLong LEGACY_OPTION_DEPRECATION_WARNED = new GlobalAtomicLong(0L);
|
||||
|
||||
static OptionValues initializeOptions() {
|
||||
|
||||
// Parse "graal." options.
|
||||
|
@ -897,12 +902,20 @@ final class HotSpotGraalOptionValuesUtil {
|
|||
return options;
|
||||
}
|
||||
|
||||
private static String withoutPrefix(String value, String prefix, String prefixAlias) {
|
||||
private static String withoutPrefix(String value, String prefix, String legacyPrefix) {
|
||||
if (value.startsWith(prefix)) {
|
||||
return value.substring(prefix.length());
|
||||
}
|
||||
if (value.startsWith(prefixAlias)) {
|
||||
return value.substring(prefixAlias.length());
|
||||
if (value.startsWith(legacyPrefix)) {
|
||||
String baseName = value.substring(legacyPrefix.length());
|
||||
if (LEGACY_OPTION_DEPRECATION_WARNED.compareAndSet(0L, 1L)) {
|
||||
System.err.printf("""
|
||||
WARNING: The '%s' property prefix for the Graal option %s
|
||||
WARNING: (and all other Graal options) is deprecated and will be ignored
|
||||
WARNING: in a future release. Please use 'jdk.graal.%s' instead.%n""",
|
||||
legacyPrefix, baseName, baseName);
|
||||
}
|
||||
return baseName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue