Search in sources :

Example 1 with TruffleInliningDecision

use of org.graalvm.compiler.truffle.runtime.TruffleInliningDecision in project graal by oracle.

the class TraceCallTreeListener method logTruffleCallTree.

private void logTruffleCallTree(OptimizedCallTarget compilable, TruffleInlining inliningDecision) {
    CallTreeNodeVisitor visitor = new CallTreeNodeVisitor() {

        @Override
        public boolean visit(List<TruffleInlining> decisionStack, Node node) {
            if (node instanceof OptimizedDirectCallNode) {
                OptimizedDirectCallNode callNode = ((OptimizedDirectCallNode) node);
                int depth = decisionStack == null ? 0 : decisionStack.size() - 1;
                TruffleInliningDecision inlining = CallTreeNodeVisitor.getCurrentInliningDecision(decisionStack);
                String dispatched = "<dispatched>";
                if (inlining != null && inlining.shouldInline()) {
                    dispatched = "";
                }
                Map<String, Object> properties = new LinkedHashMap<>();
                GraalTruffleRuntimeListener.addASTSizeProperty(callNode.getCurrentCallTarget(), inliningDecision, properties);
                properties.putAll(callNode.getCurrentCallTarget().getDebugProperties(inliningDecision));
                runtime.logEvent(depth, "opt call tree", callNode.getCurrentCallTarget().toString() + dispatched, properties);
            } else if (node instanceof OptimizedIndirectCallNode) {
                int depth = decisionStack == null ? 0 : decisionStack.size() - 1;
                runtime.logEvent(depth, "opt call tree", "<indirect>", new LinkedHashMap<>());
            }
            return true;
        }
    };
    compilable.accept(visitor, inliningDecision);
}
Also used : TruffleInliningDecision(org.graalvm.compiler.truffle.runtime.TruffleInliningDecision) OptimizedIndirectCallNode(org.graalvm.compiler.truffle.runtime.OptimizedIndirectCallNode) Node(com.oracle.truffle.api.nodes.Node) OptimizedIndirectCallNode(org.graalvm.compiler.truffle.runtime.OptimizedIndirectCallNode) OptimizedDirectCallNode(org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode) List(java.util.List) OptimizedDirectCallNode(org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode) CallTreeNodeVisitor(org.graalvm.compiler.truffle.runtime.TruffleInlining.CallTreeNodeVisitor) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with TruffleInliningDecision

use of org.graalvm.compiler.truffle.runtime.TruffleInliningDecision in project graal by oracle.

the class PerformanceTruffleInliningTest method assertRootCallsExplored.

private static void assertRootCallsExplored(OptimizedCallTarget target, int explored) {
    final TruffleInlining truffleInliningDecisions = new TruffleInlining(target, POLICY);
    int knowsCallSites = 0;
    for (TruffleInliningDecision decision : truffleInliningDecisions) {
        if (decision.getCallSites().size() > 0) {
            knowsCallSites++;
        }
    }
    // The exploration brudged should be blown before exploring the other 2 call sites of the
    // root
    Assert.assertEquals("Only one target should not know about it's call sites!", explored, knowsCallSites);
}
Also used : TruffleInliningDecision(org.graalvm.compiler.truffle.runtime.TruffleInliningDecision) TruffleInlining(org.graalvm.compiler.truffle.runtime.TruffleInlining)

Example 3 with TruffleInliningDecision

use of org.graalvm.compiler.truffle.runtime.TruffleInliningDecision in project graal by oracle.

the class TruffleInliningTest method traverseDecisions.

void traverseDecisions(List<TruffleInliningDecision> decisions, Consumer<TruffleInliningDecision> f) {
    for (TruffleInliningDecision decision : decisions) {
        f.accept(decision);
        traverseDecisions(decision.getCallSites(), f);
    }
}
Also used : TruffleInliningDecision(org.graalvm.compiler.truffle.runtime.TruffleInliningDecision)

Example 4 with TruffleInliningDecision

use of org.graalvm.compiler.truffle.runtime.TruffleInliningDecision in project graal by oracle.

the class TraceInliningListener method logInliningDecisionRecursive.

private void logInliningDecisionRecursive(OptimizedCallTarget target, TruffleInlining inliningDecision, int depth) {
    for (TruffleInliningDecision decision : inliningDecision) {
        TruffleInliningProfile profile = decision.getProfile();
        boolean inlined = decision.shouldInline();
        String msg = inlined ? "inline success" : "inline failed";
        runtime.logEvent(depth, msg, decision.getProfile().getCallNode().getCurrentCallTarget().toString(), profile.getDebugProperties());
        if (inlined) {
            logInliningDecisionRecursive(target, decision, depth + 1);
        }
    }
}
Also used : TruffleInliningDecision(org.graalvm.compiler.truffle.runtime.TruffleInliningDecision) TruffleInliningProfile(org.graalvm.compiler.truffle.runtime.TruffleInliningProfile)

Aggregations

TruffleInliningDecision (org.graalvm.compiler.truffle.runtime.TruffleInliningDecision)4 Node (com.oracle.truffle.api.nodes.Node)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 OptimizedDirectCallNode (org.graalvm.compiler.truffle.runtime.OptimizedDirectCallNode)1 OptimizedIndirectCallNode (org.graalvm.compiler.truffle.runtime.OptimizedIndirectCallNode)1 TruffleInlining (org.graalvm.compiler.truffle.runtime.TruffleInlining)1 CallTreeNodeVisitor (org.graalvm.compiler.truffle.runtime.TruffleInlining.CallTreeNodeVisitor)1 TruffleInliningProfile (org.graalvm.compiler.truffle.runtime.TruffleInliningProfile)1