Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 14982:1422f0bd55e3
Truffle: Truffle API changes for context sensitive inlining.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 03 Apr 2014 18:33:48 +0200 |
parents | 762c9aceb7d8 |
children | 448338c9ce96 |
comparison
equal
deleted
inserted
replaced
14981:b5fed092083f | 14982:1422f0bd55e3 |
---|---|
649 return true; | 649 return true; |
650 } | 650 } |
651 | 651 |
652 } | 652 } |
653 | 653 |
654 public static void printInliningTree(final PrintStream stream, RootNode root) { | |
655 printRootNode(stream, 0, root); | |
656 root.accept(new NodeVisitor() { | |
657 int depth = 1; | |
658 | |
659 public boolean visit(Node node) { | |
660 if (node instanceof CallNode) { | |
661 CallNode callNode = ((CallNode) node); | |
662 RootNode inlinedRoot = callNode.getCurrentRootNode(); | |
663 if (inlinedRoot != null && callNode.isInlined()) { | |
664 depth++; | |
665 printRootNode(stream, depth * 2, inlinedRoot); | |
666 inlinedRoot.accept(this); | |
667 depth--; | |
668 } | |
669 } | |
670 return true; | |
671 } | |
672 }); | |
673 } | |
674 | |
675 private static void printRootNode(PrintStream stream, int indent, RootNode root) { | |
676 for (int i = 0; i < indent; i++) { | |
677 stream.print(" "); | |
678 } | |
679 stream.print(root.toString()); | |
680 stream.print(" ("); | |
681 stream.print(countNodes(root)); | |
682 stream.print("/"); | |
683 stream.print(countNodes(root, null, true)); | |
684 stream.println(")"); | |
685 } | |
686 | |
687 public static String printCompactTreeToString(Node node) { | 654 public static String printCompactTreeToString(Node node) { |
688 StringWriter out = new StringWriter(); | 655 StringWriter out = new StringWriter(); |
689 printCompactTree(new PrintWriter(out), null, node, 1); | 656 printCompactTree(new PrintWriter(out), null, node, 1); |
690 return out.toString(); | 657 return out.toString(); |
691 } | 658 } |