Search in sources :

Example 1 with DebugHandlersFactory

use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.

the class HotSpotHostBackend method completeInitialization.

@Override
@SuppressWarnings("try")
public void completeInitialization(HotSpotJVMCIRuntime jvmciRuntime, OptionValues options) {
    final HotSpotProviders providers = getProviders();
    HotSpotHostForeignCallsProvider foreignCalls = (HotSpotHostForeignCallsProvider) providers.getForeignCalls();
    final HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
    try (InitTimer st = timer("foreignCalls.initialize")) {
        foreignCalls.initialize(providers, options);
    }
    try (InitTimer st = timer("lowerer.initialize")) {
        Iterable<DebugHandlersFactory> factories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection()));
        lowerer.initialize(options, factories, providers, config);
    }
}
Also used : HotSpotHostForeignCallsProvider(org.graalvm.compiler.hotspot.meta.HotSpotHostForeignCallsProvider) InitTimer(jdk.vm.ci.common.InitTimer) HotSpotLoweringProvider(org.graalvm.compiler.hotspot.meta.HotSpotLoweringProvider) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory)

Example 2 with DebugHandlersFactory

use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.

the class NativeImageGenerator method registerReplacements.

@SuppressWarnings("try")
public static void registerReplacements(DebugContext debug, FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, Providers providers, SnippetReflectionProvider snippetReflection, boolean hosted) {
    OptionValues options = hosted ? HostedOptionValues.singleton() : RuntimeOptionValues.singleton();
    Providers runtimeCallProviders = runtimeConfig != null ? runtimeConfig.getBackendForNormalMethod().getProviders() : providers;
    SubstrateForeignCallsProvider foreignCallsProvider = (SubstrateForeignCallsProvider) providers.getForeignCalls();
    for (SubstrateForeignCallDescriptor descriptor : SnippetRuntime.getRuntimeCalls()) {
        foreignCallsProvider.getForeignCalls().put(descriptor, new SubstrateForeignCallLinkage(runtimeCallProviders, descriptor));
    }
    featureHandler.forEachGraalFeature(feature -> feature.registerForeignCalls(runtimeConfig, runtimeCallProviders, snippetReflection, foreignCallsProvider.getForeignCalls(), hosted));
    try (DebugContext.Scope s = debug.scope("RegisterLowerings", new DebugDumpScope("RegisterLowerings"))) {
        SubstrateLoweringProvider lowerer = (SubstrateLoweringProvider) providers.getLowerer();
        Map<Class<? extends Node>, NodeLoweringProvider<?>> lowerings = lowerer.getLowerings();
        Iterable<DebugHandlersFactory> factories = runtimeConfig != null ? runtimeConfig.getDebugHandlersFactories() : Collections.singletonList(new GraalDebugHandlersFactory(snippetReflection));
        lowerer.setConfiguration(runtimeConfig, options, factories, providers, snippetReflection);
        NonSnippetLowerings.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings);
        ArithmeticSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        MonitorSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        TypeSnippets.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings);
        ExceptionSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        if (hosted) {
            AssertSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
            DeoptHostedSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        } else {
            DeoptRuntimeSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        }
        if (NativeImageOptions.DeoptimizeAll.getValue()) {
            DeoptTestSnippets.registerLowerings(options, factories, providers, snippetReflection, lowerings);
        }
        featureHandler.forEachGraalFeature(feature -> feature.registerLowerings(runtimeConfig, options, factories, providers, snippetReflection, lowerings, hosted));
    } catch (Throwable e) {
        throw debug.handle(e);
    }
    SubstrateReplacements replacements = (SubstrateReplacements) providers.getReplacements();
    assert checkInvocationPluginMethods(replacements);
    replacements.encodeSnippets();
}
Also used : SubstrateForeignCallDescriptor(com.oracle.svm.core.snippets.SnippetRuntime.SubstrateForeignCallDescriptor) HostedOptionValues(com.oracle.svm.core.option.HostedOptionValues) RuntimeOptionValues(com.oracle.svm.core.option.RuntimeOptionValues) OptionValues(org.graalvm.compiler.options.OptionValues) SubstrateLoweringProvider(com.oracle.svm.core.graal.meta.SubstrateLoweringProvider) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) StackValueNode(com.oracle.svm.core.graal.stackvalue.StackValueNode) Node(org.graalvm.compiler.graph.Node) SubstrateForeignCallsProvider(com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider) SubstrateForeignCallLinkage(com.oracle.svm.core.graal.meta.SubstrateForeignCallLinkage) DebugContext(org.graalvm.compiler.debug.DebugContext) Providers(org.graalvm.compiler.phases.util.Providers) HostedProviders(com.oracle.graal.pointsto.meta.HostedProviders) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) SubstrateReplacements(com.oracle.svm.core.graal.meta.SubstrateReplacements) NodeLoweringProvider(com.oracle.svm.core.graal.snippets.NodeLoweringProvider)

Example 3 with DebugHandlersFactory

use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.

the class PartialEvaluationTest method getDebugHandlersFactories.

@Override
protected Collection<DebugHandlersFactory> getDebugHandlersFactories() {
    List<DebugHandlersFactory> c = new ArrayList<>(super.getDebugHandlersFactories());
    c.add(new TruffleTreeDebugHandlersFactory());
    return c;
}
Also used : TruffleTreeDebugHandlersFactory(org.graalvm.compiler.truffle.runtime.TruffleTreeDebugHandlersFactory) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) TruffleTreeDebugHandlersFactory(org.graalvm.compiler.truffle.runtime.TruffleTreeDebugHandlersFactory) ArrayList(java.util.ArrayList)

Example 4 with DebugHandlersFactory

use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.

the class ReplacementsImpl method openDebugContext.

protected DebugContext openDebugContext(String idPrefix, ResolvedJavaMethod method) {
    DebugContext outer = DebugContext.forCurrentThread();
    Description description = new Description(method, idPrefix + nextDebugContextId.incrementAndGet());
    List<DebugHandlersFactory> factories = debugHandlersFactory == null ? Collections.emptyList() : Collections.singletonList(debugHandlersFactory);
    return DebugContext.create(options, description, outer.getGlobalMetrics(), DEFAULT_LOG_STREAM, factories);
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) Description(org.graalvm.compiler.debug.DebugContext.Description) DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) DebugContext(org.graalvm.compiler.debug.DebugContext)

Example 5 with DebugHandlersFactory

use of org.graalvm.compiler.debug.DebugHandlersFactory in project graal by oracle.

the class HotSpotTruffleCompilerImpl method getDebugHandlerFactories.

private List<DebugHandlersFactory> getDebugHandlerFactories() {
    if (factories == null) {
        // Multiple initialization by racing threads is harmless
        List<DebugHandlersFactory> list = new ArrayList<>();
        list.add(new GraalDebugHandlersFactory(snippetReflection));
        for (DebugHandlersFactory factory : DebugHandlersFactory.LOADER) {
            // Ignore other instances of GraalDebugHandlersFactory
            if (!(factory instanceof GraalDebugHandlersFactory)) {
                list.add(factory);
            }
        }
        factories = list;
    }
    return factories;
}
Also used : DebugHandlersFactory(org.graalvm.compiler.debug.DebugHandlersFactory) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory) ArrayList(java.util.ArrayList) GraalDebugHandlersFactory(org.graalvm.compiler.printer.GraalDebugHandlersFactory)

Aggregations

DebugHandlersFactory (org.graalvm.compiler.debug.DebugHandlersFactory)6 GraalDebugHandlersFactory (org.graalvm.compiler.printer.GraalDebugHandlersFactory)4 DebugContext (org.graalvm.compiler.debug.DebugContext)3 ArrayList (java.util.ArrayList)2 OptionValues (org.graalvm.compiler.options.OptionValues)2 MethodTypeFlow (com.oracle.graal.pointsto.flow.MethodTypeFlow)1 AnalysisType (com.oracle.graal.pointsto.meta.AnalysisType)1 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)1 DebugContextRunnable (com.oracle.graal.pointsto.util.CompletionExecutor.DebugContextRunnable)1 SubstrateForeignCallLinkage (com.oracle.svm.core.graal.meta.SubstrateForeignCallLinkage)1 SubstrateForeignCallsProvider (com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider)1 SubstrateLoweringProvider (com.oracle.svm.core.graal.meta.SubstrateLoweringProvider)1 SubstrateReplacements (com.oracle.svm.core.graal.meta.SubstrateReplacements)1 NodeLoweringProvider (com.oracle.svm.core.graal.snippets.NodeLoweringProvider)1 StackValueNode (com.oracle.svm.core.graal.stackvalue.StackValueNode)1 HostedOptionValues (com.oracle.svm.core.option.HostedOptionValues)1 RuntimeOptionValues (com.oracle.svm.core.option.RuntimeOptionValues)1 SubstrateForeignCallDescriptor (com.oracle.svm.core.snippets.SnippetRuntime.SubstrateForeignCallDescriptor)1 TargetDescription (jdk.vm.ci.code.TargetDescription)1 InitTimer (jdk.vm.ci.common.InitTimer)1