src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java
changeset 54204 55c262f4f5a1
parent 54084 84f10bbf993f
child 58299 6df94ce3ab2f
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java	Wed Mar 20 17:28:29 2019 +0100
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java	Wed Mar 20 22:53:44 2019 +0100
@@ -41,6 +41,7 @@
 
 import jdk.vm.ci.common.InitTimer;
 import jdk.vm.ci.common.NativeImageReinitialize;
+import jdk.vm.ci.services.Services;
 
 /**
  * The {@link #defaultOptions()} method returns the options values initialized in a HotSpot VM. The
@@ -89,15 +90,14 @@
     }
 
     /**
-     * Global options. The values for these options are initialized by parsing the file denoted by
-     * the {@code VM.getSavedProperty(String) saved} system property named
-     * {@value #GRAAL_OPTIONS_FILE_PROPERTY_NAME} if the file exists followed by parsing the options
-     * encoded in saved system properties whose names start with
-     * {@value #GRAAL_OPTION_PROPERTY_PREFIX}. Key/value pairs are parsed from the aforementioned
-     * file with {@link Properties#load(java.io.Reader)}.
+     * Gets and parses options based on {@linkplain Services#getSavedProperties() saved system
+     * properties}. The values for these options are initialized by parsing the file denoted by the
+     * {@value #GRAAL_OPTIONS_FILE_PROPERTY_NAME} property followed by parsing the options encoded
+     * in properties whose names start with {@value #GRAAL_OPTION_PROPERTY_PREFIX}. Key/value pairs
+     * are parsed from the aforementioned file with {@link Properties#load(java.io.Reader)}.
      */
     @SuppressWarnings("try")
-    private static OptionValues initializeOptions() {
+    public static EconomicMap<OptionKey<?>, Object> parseOptions() {
         EconomicMap<OptionKey<?>, Object> values = OptionValues.newOptionMap();
         try (InitTimer t = timer("InitializeOptions")) {
 
@@ -142,7 +142,17 @@
             }
 
             OptionsParser.parseOptions(optionSettings, values, loader);
-            return new OptionValues(values);
+            return values;
         }
     }
+
+    /**
+     * Substituted by
+     * {@code com.oracle.svm.graal.hotspot.libgraal.Target_org_graalvm_compiler_hotspot_HotSpotGraalOptionValues}
+     * to update {@code com.oracle.svm.core.option.RuntimeOptionValues.singleton()} instead of
+     * creating a new {@link OptionValues} object.
+     */
+    private static OptionValues initializeOptions() {
+        return new OptionValues(parseOptions());
+    }
 }