# HG changeset patch # User Thomas Wuerthinger # Date 1382434930 -7200 # Node ID 3ee8ae69d676ede55b308bbb3c32f6353523ed8b # Parent 36f39d0c98753e10d6bdf12c95ac25a8d194a91b Introduce TraceTruffleInliningTree option. diff -r 36f39d0c9875 -r 3ee8ae69d676 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Thu Oct 17 17:26:18 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Tue Oct 22 11:42:10 2013 +0200 @@ -130,6 +130,10 @@ config.setSkippedExceptionTypes(skippedExceptionTypes); runtime.evictDeoptedGraphs(); + if (TraceTruffleInliningTree.getValue()) { + printInlineTree(compilable.getRootNode()); + } + long timeCompilationStarted = System.nanoTime(); Assumptions assumptions = new Assumptions(true); try (TimerCloseable a = PartialEvaluationTime.start()) { @@ -157,6 +161,37 @@ return compiledMethod; } + private void printInlineTree(RootNode rootNode) { + OUT.println(); + OUT.println("Inlining tree for: " + rootNode); + rootNode.accept(new InlineTreeVisitor()); + } + + private class InlineTreeVisitor implements NodeVisitor { + + public boolean visit(Node node) { + if (node instanceof InlinedCallSite) { + InlinedCallSite inlinedCallSite = (InlinedCallSite) node; + int indent = this.indent(node); + for (int i = 0; i < indent; ++i) { + OUT.print(" "); + } + OUT.println(inlinedCallSite.getCallTarget()); + } + return true; + } + + private int indent(Node n) { + if (n instanceof RootNode) { + return 0; + } else if (n instanceof InlinedCallSite) { + return indent(n.getParent()) + 1; + } else { + return indent(n.getParent()); + } + } + } + public InstalledCode compileMethodHelper(final StructuredGraph graph, final GraphBuilderConfiguration config, final Assumptions assumptions) { final PhasePlan plan = createPhasePlan(config); diff -r 36f39d0c9875 -r 3ee8ae69d676 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Thu Oct 17 17:26:18 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java Tue Oct 22 11:42:10 2013 +0200 @@ -88,6 +88,8 @@ @Option(help = "") public static final OptionValue TraceTruffleInlining = new OptionValue<>(true); @Option(help = "") + public static final OptionValue TraceTruffleInliningTree = new OptionValue<>(false); + @Option(help = "") public static final OptionValue TraceTruffleInliningDetails = new OptionValue<>(false); @Option(help = "") public static final OptionValue TruffleCallTargetProfiling = new StableOptionValue<>(false);