src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java

Print this page

        

@@ -47,10 +47,11 @@
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.runtime.JVMCI;
 import jdk.vm.ci.runtime.JVMCIBackend;
 import jdk.vm.ci.runtime.JVMCICompiler;
 import jdk.vm.ci.service.Services;
+import sun.misc.VM;
 
 //JaCoCo Exclude
 
 /**
  * HotSpot implementation of a JVMCI runtime.

@@ -81,10 +82,26 @@
     public static HotSpotJVMCIRuntime runtime() {
         JVMCI.initialize();
         return DelayedInit.instance;
     }
 
+    /**
+     * Gets a boolean value based on a system property {@linkplain VM#getSavedProperty(String)
+     * saved} at system initialization time.
+     *
+     * @param name the name of the system property to derive a boolean value from using
+     *            {@link Boolean#parseBoolean(String)}
+     * @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(name);
+        if (value == null) {
+            return def;
+        }
+        return Boolean.parseBoolean(value);
+    }
+
     public static HotSpotJVMCIBackendFactory findFactory(String architecture) {
         for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) {
             if (factory.getArchitecture().equalsIgnoreCase(architecture)) {
                 return factory;
             }