Search in sources :

Example 1 with LIRSuites

use of org.graalvm.compiler.lir.phases.LIRSuites in project graal by oracle.

the class HotSpotGraalCompiler method compileHelper.

public CompilationResult compileHelper(CompilationResultBuilderFactory crbf, CompilationResult result, StructuredGraph graph, ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, OptionValues options) {
    HotSpotBackend backend = graalRuntime.getHostBackend();
    HotSpotProviders providers = backend.getProviders();
    final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
    Suites suites = getSuites(providers, options);
    LIRSuites lirSuites = getLIRSuites(providers, options);
    ProfilingInfo profilingInfo = useProfilingInfo ? method.getProfilingInfo(!isOSR, isOSR) : DefaultProfilingInfo.get(TriState.FALSE);
    OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo, options);
    /*
         * Cut off never executed code profiles if there is code, e.g. after the osr loop, that is
         * never executed.
         */
    if (isOSR && !OnStackReplacementPhase.Options.DeoptAfterOSR.getValue(options)) {
        optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
    }
    result.setEntryBCI(entryBCI);
    boolean shouldDebugNonSafepoints = providers.getCodeCache().shouldDebugNonSafepoints();
    PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR);
    GraalCompiler.compileGraph(graph, method, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, result, crbf);
    if (!isOSR && useProfilingInfo) {
        ProfilingInfo profile = profilingInfo;
        profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
    }
    return result;
}
Also used : HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) DefaultProfilingInfo(jdk.vm.ci.meta.DefaultProfilingInfo) ProfilingInfo(jdk.vm.ci.meta.ProfilingInfo) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) OptimisticOptimizations(org.graalvm.compiler.phases.OptimisticOptimizations) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 2 with LIRSuites

use of org.graalvm.compiler.lir.phases.LIRSuites in project graal by oracle.

the class HotSpotTruffleCompilerImpl method compileTruffleCallBoundaryMethod.

/**
 * Compiles a method denoted as a
 * {@linkplain HotSpotTruffleCompilerRuntime#getTruffleCallBoundaryMethods() Truffle call
 * boundary}. The compiled code has a special entry point generated by an
 * {@link TruffleCallBoundaryInstrumentationFactory}.
 */
private CompilationResult compileTruffleCallBoundaryMethod(ResolvedJavaMethod javaMethod, CompilationIdentifier compilationId, DebugContext debug) {
    Suites newSuites = this.suites.copy();
    removeInliningPhase(newSuites);
    OptionValues options = TruffleCompilerOptions.getOptions();
    StructuredGraph graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.NO).method(javaMethod).compilationId(compilationId).build();
    MetaAccessProvider metaAccess = providers.getMetaAccess();
    Plugins plugins = new Plugins(new InvocationPlugins());
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) providers.getCodeCache();
    boolean infoPoints = codeCache.shouldDebugNonSafepoints();
    GraphBuilderConfiguration newConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true).withNodeSourcePosition(infoPoints);
    new GraphBuilderPhase.Instance(metaAccess, providers.getStampProvider(), providers.getConstantReflection(), providers.getConstantFieldProvider(), newConfig, OptimisticOptimizations.ALL, null).apply(graph);
    PhaseSuite<HighTierContext> graphBuilderSuite = getGraphBuilderSuite(codeCache, backend.getSuites());
    CompilationResultBuilderFactory factory = getTruffleCallBoundaryInstrumentationFactory(backend.getTarget().arch.getName());
    return compileGraph(graph, javaMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), newSuites, lirSuites, new CompilationResult(compilationId), factory);
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) OptionValues(org.graalvm.compiler.options.OptionValues) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) CompilationResult(org.graalvm.compiler.code.CompilationResult) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) CompilationResultBuilderFactory(org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 3 with LIRSuites

use of org.graalvm.compiler.lir.phases.LIRSuites in project graal by oracle.

the class HotSpotTruffleCompilerImpl method create.

public static HotSpotTruffleCompilerImpl create(TruffleCompilerRuntime runtime) {
    HotSpotGraalRuntimeProvider hotspotGraalRuntime = (HotSpotGraalRuntimeProvider) runtime.getGraalRuntime();
    Backend backend = hotspotGraalRuntime.getHostBackend();
    OptionValues options = TruffleCompilerOptions.getOptions();
    Suites suites = backend.getSuites().getDefaultSuites(options);
    LIRSuites lirSuites = backend.getSuites().getDefaultLIRSuites(options);
    GraphBuilderPhase phase = (GraphBuilderPhase) backend.getSuites().getDefaultGraphBuilderSuite().findPhase(GraphBuilderPhase.class).previous();
    Plugins plugins = phase.getGraphBuilderConfig().getPlugins();
    SnippetReflectionProvider snippetReflection = hotspotGraalRuntime.getRequiredCapability(SnippetReflectionProvider.class);
    return new HotSpotTruffleCompilerImpl(hotspotGraalRuntime, runtime, plugins, suites, lirSuites, backend, snippetReflection);
}
Also used : Backend(org.graalvm.compiler.core.target.Backend) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) OptionValues(org.graalvm.compiler.options.OptionValues) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 4 with LIRSuites

use of org.graalvm.compiler.lir.phases.LIRSuites in project graal by oracle.

the class MatchRuleTest method createLIRSuites.

@Override
protected LIRSuites createLIRSuites(OptionValues options) {
    LIRSuites suites = super.createLIRSuites(options);
    suites.getPreAllocationOptimizationStage().appendPhase(new CheckPhase());
    return suites;
}
Also used : LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites)

Example 5 with LIRSuites

use of org.graalvm.compiler.lir.phases.LIRSuites in project graal by oracle.

the class Stub method buildCompilationResult.

@SuppressWarnings("try")
private CompilationResult buildCompilationResult(DebugContext debug, final Backend backend) {
    CompilationIdentifier compilationId = getStubCompilationId();
    final StructuredGraph graph = getGraph(debug, compilationId);
    CompilationResult compResult = new CompilationResult(compilationId, toString(), GeneratePIC.getValue(options));
    // Stubs cannot be recompiled so they cannot be compiled with assumptions
    assert graph.getAssumptions() == null;
    if (!(graph.start() instanceof StubStartNode)) {
        StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
        newStart.setStateAfter(graph.start().stateAfter());
        graph.replaceFixed(graph.start(), newStart);
    }
    try (DebugContext.Scope s0 = debug.scope("StubCompilation", graph, providers.getCodeCache())) {
        Suites suites = createSuites();
        emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
        LIRSuites lirSuites = createLIRSuites();
        emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
        assert checkStubInvariants(compResult);
    } catch (Throwable e) {
        throw debug.handle(e);
    }
    return compResult;
}
Also used : CompilationIdentifier(org.graalvm.compiler.core.common.CompilationIdentifier) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) StubStartNode(org.graalvm.compiler.hotspot.nodes.StubStartNode) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) CompilationResult(org.graalvm.compiler.code.CompilationResult) DebugContext(org.graalvm.compiler.debug.DebugContext) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Aggregations

LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)10 Suites (org.graalvm.compiler.phases.tiers.Suites)7 CompilationResult (org.graalvm.compiler.code.CompilationResult)4 DebugContext (org.graalvm.compiler.debug.DebugContext)4 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)4 Backend (org.graalvm.compiler.core.target.Backend)3 OptionValues (org.graalvm.compiler.options.OptionValues)3 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)3 ProfilingInfo (jdk.vm.ci.meta.ProfilingInfo)2 CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)2 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)2 CompilationResultBuilderFactory (org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory)2 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)2 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)2 OptimisticOptimizations (org.graalvm.compiler.phases.OptimisticOptimizations)2 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)1 DeoptEntryInfopoint (com.oracle.svm.core.deopt.DeoptEntryInfopoint)1 RuntimeConfiguration (com.oracle.svm.core.graal.meta.RuntimeConfiguration)1 SubstrateReplacements (com.oracle.svm.core.graal.meta.SubstrateReplacements)1 GraalSupport (com.oracle.svm.graal.GraalSupport)1