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);
}
}
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;
}
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);
}
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;
}
Aggregations