Search in sources :

Example 1 with Inlineable

use of org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable in project graal by oracle.

the class AbstractInlineInfo method populateInlinableElements.

@Override
@SuppressWarnings("try")
public final void populateInlinableElements(HighTierContext context, StructuredGraph caller, CanonicalizerPhase canonicalizer, OptionValues options) {
    for (int i = 0; i < numberOfMethods(); i++) {
        Inlineable elem = Inlineable.getInlineableElement(methodAt(i), invoke, context, canonicalizer, caller.trackNodeSourcePosition());
        setInlinableElement(i, elem);
    }
}
Also used : Inlineable(org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable)

Example 2 with Inlineable

use of org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable in project graal by oracle.

the class InliningData method topGraphsForTopInvocation.

/**
 * Checks an invariant that {@link #moveForward()} must maintain: "the top invocation records
 * how many concrete target methods (for it) remain on the {@link #graphQueue}; those targets
 * 'belong' to the current invocation in question.
 */
private boolean topGraphsForTopInvocation() {
    if (invocationQueue.isEmpty()) {
        assert graphQueue.isEmpty();
        return true;
    }
    if (currentInvocation().isRoot()) {
        if (!graphQueue.isEmpty()) {
            assert graphQueue.size() == 1;
        }
        return true;
    }
    final int remainingGraphs = currentInvocation().totalGraphs() - currentInvocation().processedGraphs();
    final Iterator<CallsiteHolder> iter = graphQueue.iterator();
    for (int i = (remainingGraphs - 1); i >= 0; i--) {
        if (!iter.hasNext()) {
            assert false;
            return false;
        }
        CallsiteHolder queuedTargetCH = iter.next();
        Inlineable targetIE = currentInvocation().callee().inlineableElementAt(i);
        InlineableGraph targetIG = (InlineableGraph) targetIE;
        assert queuedTargetCH.method().equals(targetIG.getGraph().method());
    }
    return true;
}
Also used : InlineableGraph(org.graalvm.compiler.phases.common.inlining.info.elem.InlineableGraph) Inlineable(org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable)

Example 3 with Inlineable

use of org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable in project graal by oracle.

the class MethodInvocation method buildCallsiteHolderForElement.

public CallsiteHolder buildCallsiteHolderForElement(int index) {
    Inlineable elem = callee.inlineableElementAt(index);
    assert elem instanceof InlineableGraph;
    InlineableGraph ig = (InlineableGraph) elem;
    final double invokeProbability = probability * callee.probabilityAt(index);
    final double invokeRelevance = relevance * callee.relevanceAt(index);
    return new CallsiteHolderExplorable(ig.getGraph(), invokeProbability, invokeRelevance, freshlyInstantiatedArguments, null);
}
Also used : InlineableGraph(org.graalvm.compiler.phases.common.inlining.info.elem.InlineableGraph) Inlineable(org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable)

Example 4 with Inlineable

use of org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable in project graal by oracle.

the class AbstractInliningPolicy method determineInvokeProbability.

protected static double determineInvokeProbability(InlineInfo info) {
    double invokeProbability = 0;
    for (int i = 0; i < info.numberOfMethods(); i++) {
        Inlineable callee = info.inlineableElementAt(i);
        Iterable<Invoke> invokes = callee.getInvokes();
        if (invokes.iterator().hasNext()) {
            for (Invoke invoke : invokes) {
                invokeProbability += callee.getProbability(invoke);
            }
        }
    }
    return invokeProbability;
}
Also used : Inlineable(org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable) Invoke(org.graalvm.compiler.nodes.Invoke)

Aggregations

Inlineable (org.graalvm.compiler.phases.common.inlining.info.elem.Inlineable)4 InlineableGraph (org.graalvm.compiler.phases.common.inlining.info.elem.InlineableGraph)2 Invoke (org.graalvm.compiler.nodes.Invoke)1