RFR (S): 8146820: JVMCI properties should use HotSpotJVMCIRuntime.getBooleanProperty mechanism
Christian Thalinger
christian.thalinger at oracle.com
Mon Jan 11 19:15:27 UTC 2016
https://bugs.openjdk.java.net/browse/JDK-8146820
I’ve renamed traceMethodDataFilter to TraceMethodDataFilter. Should we rename printconfig to PrintConfig?
diff -r c90679b0ea25 src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Fri Dec 18 20:23:28 2015 +0300
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java Mon Jan 11 09:12:48 2016 -1000
@@ -85,6 +85,21 @@ public final class HotSpotJVMCIRuntime i
}
/**
+ * Gets a String value based on a system property {@linkplain VM#getSavedProperty(String) saved}
+ * at system initialization time. The property name is prefixed with "{@code jvmci.}".
+ *
+ * @param name the name of the system property
+ * @param def the value to return if there is no system property corresponding to {@code name}
+ */
+ public static String getProperty(String name, String def) {
+ String value = VM.getSavedProperty("jvmci." + name);
+ if (value == null) {
+ return def;
+ }
+ return value;
+ }
+
+ /**
* Gets a boolean value based on a system property {@linkplain VM#getSavedProperty(String)
* saved} at system initialization time. The property name is prefixed with "{@code jvmci.}".
*
@@ -93,7 +108,7 @@ public final class HotSpotJVMCIRuntime i
* @param def the value to return if there is no system property corresponding to {@code name}
*/
public static boolean getBooleanProperty(String name, boolean def) {
- String value = VM.getSavedProperty("jvmci." + name);
+ String value = getProperty(name, null);
if (value == null) {
return def;
}
@@ -164,7 +179,7 @@ public final class HotSpotJVMCIRuntime i
}
metaAccessContext = context;
- if (Boolean.valueOf(System.getProperty("jvmci.printconfig"))) {
+ if (getBooleanProperty("printconfig", false)) {
printConfig(config, compilerToVm);
}
diff -r c90679b0ea25 src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Fri Dec 18 20:23:28 2015 +0300
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Mon Jan 11 09:12:48 2016 -1000
@@ -417,7 +417,7 @@ final class HotSpotResolvedJavaMethodImp
return false;
}
- private static final String TraceMethodDataFilter = System.getProperty("jvmci.traceMethodDataFilter");
+ private static final String TraceMethodDataFilter = HotSpotJVMCIRuntime.getProperty("TraceMethodDataFilter", null);
@Override
public ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) {
diff -r c90679b0ea25 src/jdk.vm.ci/share/classes/jdk.vm.ci.inittimer/src/jdk/vm/ci/inittimer/InitTimer.java
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.inittimer/src/jdk/vm/ci/inittimer/InitTimer.java Fri Dec 18 20:23:28 2015 +0300
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.inittimer/src/jdk/vm/ci/inittimer/InitTimer.java Mon Jan 11 09:12:48 2016 -1000
@@ -65,9 +65,11 @@ public final class InitTimer implements
}
/**
- * Specifies if initialization timing is enabled.
+ * Specifies if initialization timing is enabled. Note: this property cannot use
+ * {@code HotSpotJVMCIRuntime.getBooleanProperty} since that class is not visible from this
+ * package.
*/
- private static final boolean ENABLED = Boolean.getBoolean("jvmci.inittimer") || Boolean.getBoolean("jvmci.runtime.TimeInit");
+ private static final boolean ENABLED = Boolean.getBoolean("jvmci.inittimer");
public static final AtomicInteger nesting = ENABLED ? new AtomicInteger() : null;
public static final String SPACES = " ";
More information about the hotspot-compiler-dev
mailing list