use of org.graalvm.compiler.options.OptionKey in project graal by oracle.
the class CompileTheWorldTest method testJDK.
@Test
public void testJDK() throws Throwable {
ExceptionAction originalBailoutAction = CompilationBailoutAction.getValue(getInitialOptions());
ExceptionAction originalFailureAction = CompilationFailureAction.getValue(getInitialOptions());
// Compile a couple classes in rt.jar
HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
System.setProperty("CompileTheWorld.LimitModules", "java.base");
OptionValues initialOptions = getInitialOptions();
EconomicMap<OptionKey<?>, Object> compilationOptions = CompileTheWorld.parseOptions("Inline=false");
new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), CompileTheWorld.SUN_BOOT_CLASS_PATH, 1, 5, null, null, false, initialOptions, compilationOptions).compile();
assert CompilationBailoutAction.getValue(initialOptions) == originalBailoutAction;
assert CompilationFailureAction.getValue(initialOptions) == originalFailureAction;
}
use of org.graalvm.compiler.options.OptionKey in project graal by oracle.
the class GraalOSRLockTest method testLockOSROuterCompileRestOfMethod.
@Test
@SuppressWarnings("try")
public void testLockOSROuterCompileRestOfMethod() {
run(() -> {
EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
overrides.put(HighTier.Options.Inline, false);
OptionValues options = new OptionValues(getInitialOptions(), overrides);
testOSR(options, "testOuterLockCompileRestOfMethod");
});
}
use of org.graalvm.compiler.options.OptionKey in project graal by oracle.
the class GraalOSRLockTest method testLockOSROuterInnerLockDepthCompileRestOfMethod.
@Test
@SuppressWarnings("try")
public void testLockOSROuterInnerLockDepthCompileRestOfMethod() {
run(() -> {
EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
overrides.put(HighTier.Options.Inline, false);
OptionValues options = new OptionValues(getInitialOptions(), overrides);
testOSR(options, "testOuterInnerLockDepth1CompileRestOfMethod");
});
}
use of org.graalvm.compiler.options.OptionKey in project graal by oracle.
the class GraalOSRLockTest method testLockOSROuterInnerLockDepthDeopt.
@Test
@SuppressWarnings("try")
public void testLockOSROuterInnerLockDepthDeopt() {
run(() -> {
EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
overrides.put(HighTier.Options.Inline, false);
OptionValues options = new OptionValues(getInitialOptions(), overrides);
testOSR(options, "testOuterInnerLockDepth1DeoptAfter");
});
}
use of org.graalvm.compiler.options.OptionKey in project graal by oracle.
the class HotSpotGraalOptionValues method initializeOptions.
/**
* 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)}.
*/
@SuppressWarnings("try")
private static OptionValues initializeOptions() {
EconomicMap<OptionKey<?>, Object> values = OptionValues.newOptionMap();
try (InitTimer t = timer("InitializeOptions")) {
Iterable<OptionDescriptors> loader = OptionsParser.getOptionsLoader();
Map<String, String> savedProps = jdk.vm.ci.services.Services.getSavedProperties();
String optionsFile = savedProps.get(GRAAL_OPTIONS_FILE_PROPERTY_NAME);
if (optionsFile != null) {
File graalOptions = new File(optionsFile);
if (graalOptions.exists()) {
try (FileReader fr = new FileReader(graalOptions)) {
Properties props = new Properties();
props.load(fr);
EconomicMap<String, String> optionSettings = EconomicMap.create();
for (Map.Entry<Object, Object> e : props.entrySet()) {
optionSettings.put((String) e.getKey(), (String) e.getValue());
}
try {
OptionsParser.parseOptions(optionSettings, values, loader);
} catch (Throwable e) {
throw new InternalError("Error parsing an option from " + graalOptions, e);
}
} catch (IOException e) {
throw new InternalError("Error reading " + graalOptions, e);
}
}
}
EconomicMap<String, String> optionSettings = EconomicMap.create();
for (Map.Entry<String, String> e : savedProps.entrySet()) {
String name = e.getKey();
if (name.startsWith(GRAAL_OPTION_PROPERTY_PREFIX)) {
if (name.equals("graal.PrintFlags") || name.equals("graal.ShowFlags")) {
System.err.println("The " + name + " option has been removed and will be ignored. Use -XX:+JVMCIPrintProperties instead.");
} else if (name.equals(GRAAL_OPTIONS_FILE_PROPERTY_NAME) || name.equals(GRAAL_VERSION_PROPERTY_NAME)) {
// Ignore well known properties that do not denote an option
} else {
String value = e.getValue();
optionSettings.put(name.substring(GRAAL_OPTION_PROPERTY_PREFIX.length()), value);
}
}
}
OptionsParser.parseOptions(optionSettings, values, loader);
return new OptionValues(values);
}
}
Aggregations