Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java @ 17401:c0f71f81708a
Truffle: fixes to the call tree logging.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 09 Oct 2014 17:25:47 +0200 |
parents | 1422f0bd55e3 |
children | 7735bac1f781 |
comparison
equal
deleted
inserted
replaced
17400:e3dd05527c2f | 17401:c0f71f81708a |
---|---|
57 private Element groupElement; | 57 private Element groupElement; |
58 private Element graphElement; | 58 private Element graphElement; |
59 private Element nodesElement; | 59 private Element nodesElement; |
60 private Element edgesElement; | 60 private Element edgesElement; |
61 | 61 |
62 private ChildSupplier childSupplier; | |
63 | |
64 public GraphPrintVisitor() { | 62 public GraphPrintVisitor() { |
65 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | 63 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
66 try { | 64 try { |
67 DocumentBuilder db = dbf.newDocumentBuilder(); | 65 DocumentBuilder db = dbf.newDocumentBuilder(); |
68 | 66 |
71 throw new RuntimeException(ex); | 69 throw new RuntimeException(ex); |
72 } | 70 } |
73 | 71 |
74 graphDocument = dom.createElement("graphDocument"); | 72 graphDocument = dom.createElement("graphDocument"); |
75 dom.appendChild(graphDocument); | 73 dom.appendChild(graphDocument); |
76 } | |
77 | |
78 public void setChildSupplier(ChildSupplier callNodeVisitor) { | |
79 this.childSupplier = callNodeVisitor; | |
80 } | |
81 | |
82 public ChildSupplier getChildSupplier() { | |
83 return childSupplier; | |
84 } | 74 } |
85 | 75 |
86 public GraphPrintVisitor beginGroup(String groupName) { | 76 public GraphPrintVisitor beginGroup(String groupName) { |
87 groupElement = dom.createElement("group"); | 77 groupElement = dom.createElement("group"); |
88 graphDocument.appendChild(groupElement); | 78 graphDocument.appendChild(groupElement); |
335 } else if (NodeUtil.findAnnotation(node.getClass(), NullGraphPrintHandler.class) != null) { | 325 } else if (NodeUtil.findAnnotation(node.getClass(), NullGraphPrintHandler.class) != null) { |
336 // ignore | 326 // ignore |
337 } else { | 327 } else { |
338 // default handler | 328 // default handler |
339 createElementForNode(node); | 329 createElementForNode(node); |
340 | |
341 if (childSupplier != null) { | |
342 Object result = childSupplier.startNode(node); | |
343 if (result != null) { | |
344 visit(result); | |
345 connectNodes(node, result, "inlined"); | |
346 } | |
347 childSupplier.endNode(node); | |
348 } | |
349 | 330 |
350 if (node instanceof Node) { | 331 if (node instanceof Node) { |
351 for (Map.Entry<String, Node> child : findNamedNodeChildren((Node) node).entrySet()) { | 332 for (Map.Entry<String, Node> child : findNamedNodeChildren((Node) node).entrySet()) { |
352 visit(child.getValue()); | 333 visit(child.getValue()); |
353 connectNodes(node, child.getValue(), child.getKey()); | 334 connectNodes(node, child.getValue(), child.getKey()); |