< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalOptionValues.java
Print this page
@@ -38,13 +38,14 @@
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.options.OptionsParser;
import jdk.vm.ci.common.InitTimer;
+import jdk.vm.ci.common.NativeImageReinitialize;
/**
- * The {@link #HOTSPOT_OPTIONS} value contains the options values initialized in a HotSpot VM. The
+ * The {@link #defaultOptions()} method returns the options values initialized in a HotSpot VM. The
* values are set via system properties with the {@value #GRAAL_OPTION_PROPERTY_PREFIX} prefix.
*/
public class HotSpotGraalOptionValues {
/**
@@ -69,11 +70,25 @@
*/
public static String asSystemPropertySetting(OptionValues options, OptionKey<?> value) {
return GRAAL_OPTION_PROPERTY_PREFIX + value.getName() + "=" + value.getValue(options);
}
- public static final OptionValues HOTSPOT_OPTIONS = initializeOptions();
+ @NativeImageReinitialize private static volatile OptionValues hotspotOptions;
+
+ public static OptionValues defaultOptions() {
+ OptionValues res = hotspotOptions;
+ if (res == null) {
+ synchronized (HotSpotGraalOptionValues.class) {
+ res = hotspotOptions;
+ if (res == null) {
+ res = initializeOptions();
+ hotspotOptions = res;
+ }
+ }
+ }
+ return res;
+ }
/**
* 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
< prev index next >