use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NestedBooleanOptionKeyTest method runDefaultTrue.
@Test
public void runDefaultTrue() {
OptionValues options = new OptionValues(null, Master1, true);
assertTrue(Master1.getValue(options));
assertTrue(NestedOption1.getValue(options));
// nested value unset
options = new OptionValues(null, Master1, false);
assertFalse(Master1.getValue(options));
assertFalse(NestedOption1.getValue(options));
// set false
options = new OptionValues(null, Master1, false, NestedOption1, false);
assertFalse(Master1.getValue(options));
assertFalse(NestedOption1.getValue(options));
options = new OptionValues(null, Master1, true, NestedOption1, false);
assertTrue(Master1.getValue(options));
assertFalse(NestedOption1.getValue(options));
// set true
options = new OptionValues(null, Master1, false, NestedOption1, true);
assertFalse(Master1.getValue(options));
assertTrue(NestedOption1.getValue(options));
options = new OptionValues(null, Master1, true, NestedOption1, true);
assertTrue(Master1.getValue(options));
assertTrue(NestedOption1.getValue(options));
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class HotSpotGraphBuilderPlugins method create.
/**
* Creates a {@link Plugins} object that should be used when running on HotSpot.
*
* @param constantReflection
* @param snippetReflection
* @param foreignCalls
* @param stampProvider
*/
public static Plugins create(CompilerConfiguration compilerConfiguration, GraalHotSpotVMConfig config, HotSpotWordTypes wordTypes, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, SnippetReflectionProvider snippetReflection, ForeignCallsProvider foreignCalls, LoweringProvider lowerer, StampProvider stampProvider, ReplacementsImpl replacements) {
InvocationPlugins invocationPlugins = new HotSpotInvocationPlugins(config, compilerConfiguration);
Plugins plugins = new Plugins(invocationPlugins);
NodeIntrinsificationProvider nodeIntrinsificationProvider = new NodeIntrinsificationProvider(metaAccess, snippetReflection, foreignCalls, lowerer, wordTypes);
HotSpotWordOperationPlugin wordOperationPlugin = new HotSpotWordOperationPlugin(snippetReflection, wordTypes);
HotSpotNodePlugin nodePlugin = new HotSpotNodePlugin(wordOperationPlugin);
plugins.appendTypePlugin(nodePlugin);
plugins.appendNodePlugin(nodePlugin);
OptionValues options = replacements.getOptions();
if (!GeneratePIC.getValue(options)) {
plugins.appendNodePlugin(new MethodHandlePlugin(constantReflection.getMethodHandleAccess(), true));
}
plugins.appendInlineInvokePlugin(replacements);
if (InlineDuringParsing.getValue(options)) {
plugins.appendInlineInvokePlugin(new InlineDuringParsingPlugin());
}
if (GeneratePIC.getValue(options)) {
plugins.setClassInitializationPlugin(new HotSpotClassInitializationPlugin());
if (TieredAOT.getValue(options)) {
plugins.setProfilingPlugin(new HotSpotAOTProfilingPlugin());
}
}
invocationPlugins.defer(new Runnable() {
@Override
public void run() {
BytecodeProvider replacementBytecodeProvider = replacements.getDefaultReplacementBytecodeProvider();
registerObjectPlugins(invocationPlugins, options, replacementBytecodeProvider);
registerClassPlugins(plugins, config, replacementBytecodeProvider);
registerSystemPlugins(invocationPlugins, foreignCalls);
registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config, replacementBytecodeProvider);
if (!GeneratePIC.getValue(options)) {
registerCallSitePlugins(invocationPlugins);
}
registerReflectionPlugins(invocationPlugins, replacementBytecodeProvider);
registerConstantPoolPlugins(invocationPlugins, wordTypes, config, replacementBytecodeProvider);
registerAESPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
registerCRC32CPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider);
registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider);
StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true);
registerArrayPlugins(invocationPlugins, replacementBytecodeProvider);
for (NodeIntrinsicPluginFactory factory : GraalServices.load(NodeIntrinsicPluginFactory.class)) {
factory.registerPlugins(invocationPlugins, nodeIntrinsificationProvider);
}
}
});
return plugins;
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class HotSpotProfilingPlugin method profileGoto.
@Override
public void profileGoto(GraphBuilderContext builder, ResolvedJavaMethod method, int bci, int targetBci, FrameState frameState) {
assert shouldProfile(builder, method);
OptionValues options = builder.getOptions();
if (Options.ProfileBackedges.getValue(options) && targetBci <= bci) {
ProfileNode p = builder.append(new ProfileBranchNode(method, backedgeNotifyFreqLog(options), backedgeProfilePobabilityLog(options), bci, targetBci));
p.setStateBefore(frameState);
}
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class HotSpotGraalCompiler method compileMethod.
@SuppressWarnings("try")
CompilationRequestResult compileMethod(CompilationRequest request, boolean installAsDefault) {
if (graalRuntime.isShutdown()) {
return HotSpotCompilationRequestResult.failure(String.format("Shutdown entered"), false);
}
ResolvedJavaMethod method = request.getMethod();
OptionValues options = graalRuntime.getOptions(method);
if (graalRuntime.isBootstrapping()) {
if (DebugOptions.BootstrapInitializeOnly.getValue(options)) {
return HotSpotCompilationRequestResult.failure(String.format("Skip compilation because %s is enabled", DebugOptions.BootstrapInitializeOnly.getName()), true);
}
if (bootstrapWatchDog != null) {
if (bootstrapWatchDog.hitCriticalCompilationRateOrTimeout()) {
// Drain the compilation queue to expedite completion of the bootstrap
return HotSpotCompilationRequestResult.failure("hit critical bootstrap compilation rate or timeout", true);
}
}
}
HotSpotCompilationRequest hsRequest = (HotSpotCompilationRequest) request;
try (CompilationWatchDog w1 = CompilationWatchDog.watch(method, hsRequest.getId(), options);
BootstrapWatchDog.Watch w2 = bootstrapWatchDog == null ? null : bootstrapWatchDog.watch(request);
CompilationAlarm alarm = CompilationAlarm.trackCompilationPeriod(options)) {
if (compilationCounters != null) {
compilationCounters.countCompilation(method);
}
CompilationTask task = new CompilationTask(jvmciRuntime, this, hsRequest, true, installAsDefault, options);
CompilationRequestResult r = null;
try (DebugContext debug = graalRuntime.openDebugContext(options, task.getCompilationIdentifier(), method, getDebugHandlersFactories());
Activation a = debug.activate()) {
r = task.runCompilation(debug);
}
assert r != null;
return r;
}
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class HotSpotGraalMBean method currentMap.
private OptionValues currentMap(OptionValues initialValues, ResolvedJavaMethod method) {
if (changes.isEmpty() && methodDumps.isEmpty()) {
return initialValues;
}
OptionValues current = cachedOptions;
if (current == null) {
current = new OptionValues(initialValues, changes);
cachedOptions = current;
}
if (method != null) {
for (Dump request : methodDumps) {
final String clazzName = method.getDeclaringClass().getName();
if (method.getName().equals(request.method) && clazzName.equals(request.clazz)) {
current = new OptionValues(current, DebugOptions.Dump, request.filter, DebugOptions.PrintGraphHost, request.host, DebugOptions.PrintBinaryGraphPort, request.port);
break;
}
}
}
return current;
}
Aggregations