Search in sources :

Example 1 with AgnosticInliningPhase

use of org.graalvm.compiler.truffle.compiler.phases.inlining.AgnosticInliningPhase in project graal by oracle.

the class AgnosticInliningPhaseTest method runLanguageAgnosticInliningPhase.

protected StructuredGraph runLanguageAgnosticInliningPhase(OptimizedCallTarget callTarget) {
    final PartialEvaluator partialEvaluator = getTruffleCompiler(callTarget).getPartialEvaluator();
    final CompilationIdentifier compilationIdentifier = new CompilationIdentifier() {

        @Override
        public String toString(Verbosity verbosity) {
            return "";
        }
    };
    final PartialEvaluator.Request request = partialEvaluator.new Request(callTarget.getOptionValues(), getDebugContext(), callTarget, partialEvaluator.rootForCallTarget(callTarget), compilationIdentifier, getSpeculationLog(), new TruffleCompilerImpl.CancellableTruffleCompilationTask(new TruffleCompilationTask() {

        private TruffleInliningData inlining = new TruffleInlining();

        @Override
        public boolean isCancelled() {
            return false;
        }

        @Override
        public boolean isLastTier() {
            return true;
        }

        @Override
        public TruffleInliningData inliningData() {
            return inlining;
        }

        @Override
        public boolean hasNextTier() {
            return false;
        }
    }));
    final AgnosticInliningPhase agnosticInliningPhase = new AgnosticInliningPhase(partialEvaluator, request);
    agnosticInliningPhase.apply(request.graph, getTruffleCompiler(callTarget).getPartialEvaluator().getProviders());
    return request.graph;
}
Also used : PartialEvaluator(org.graalvm.compiler.truffle.compiler.PartialEvaluator) CompilationIdentifier(org.graalvm.compiler.core.common.CompilationIdentifier) TruffleCompilerImpl(org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl) TruffleInlining(org.graalvm.compiler.truffle.runtime.TruffleInlining) TruffleInliningData(org.graalvm.compiler.truffle.common.TruffleInliningData) TruffleCompilationTask(org.graalvm.compiler.truffle.common.TruffleCompilationTask) AgnosticInliningPhase(org.graalvm.compiler.truffle.compiler.phases.inlining.AgnosticInliningPhase)

Example 2 with AgnosticInliningPhase

use of org.graalvm.compiler.truffle.compiler.phases.inlining.AgnosticInliningPhase in project graal by oracle.

the class PartialEvaluator method inliningGraphPE.

@SuppressWarnings({ "unused", "try" })
private void inliningGraphPE(Request request) {
    boolean inlined;
    try (DebugCloseable a = PartialEvaluationTimer.start(request.debug)) {
        AgnosticInliningPhase inliningPhase = new AgnosticInliningPhase(this, request);
        inliningPhase.apply(request.graph, providers);
        if (!inliningPhase.rootIsLeaf()) {
            // If we've seen a truffle call in the graph, even if we have not inlined any call
            // target, we need to run the truffle tier phases again after the PE inlining phase
            // has finalized the graph.
            // On the other hand, if there are no calls (root is a leaf) we can skip the truffle
            // tier because there are no finalization points.
            truffleTier(request);
        }
    }
    request.graph.maybeCompress();
}
Also used : DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) AgnosticInliningPhase(org.graalvm.compiler.truffle.compiler.phases.inlining.AgnosticInliningPhase)

Aggregations

AgnosticInliningPhase (org.graalvm.compiler.truffle.compiler.phases.inlining.AgnosticInliningPhase)2 CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)1 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 TruffleCompilationTask (org.graalvm.compiler.truffle.common.TruffleCompilationTask)1 TruffleInliningData (org.graalvm.compiler.truffle.common.TruffleInliningData)1 PartialEvaluator (org.graalvm.compiler.truffle.compiler.PartialEvaluator)1 TruffleCompilerImpl (org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl)1 TruffleInlining (org.graalvm.compiler.truffle.runtime.TruffleInlining)1