comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java @ 22320:5ee16f4908e5 truffle-0.9

Remove obsolete, unused classes
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 21 Oct 2015 00:16:07 +0200
parents dc83cc1f94f2
children d376969da381
comparison
equal deleted inserted replaced
22319:d0c672a6e632 22320:5ee16f4908e5
215 return nodeMap.get(op); 215 return nodeMap.get(op);
216 } 216 }
217 217
218 protected void createElementForNode(Object node) { 218 protected void createElementForNode(Object node) {
219 boolean exists = nodeMap.containsKey(node); 219 boolean exists = nodeMap.containsKey(node);
220 if (!exists || NodeUtil.findAnnotation(node.getClass(), GraphDuplicate.class) != null) { 220 if (!exists) {
221 Element nodeElem = dom.createElement("node"); 221 Element nodeElem = dom.createElement("node");
222 nodeElem.setAttribute("id", !exists ? oldOrNextId(node) : nextId()); 222 nodeElem.setAttribute("id", !exists ? oldOrNextId(node) : nextId());
223 nodeMap.put(node, nodeElem); 223 nodeMap.put(node, nodeElem);
224 Element properties = dom.createElement("properties"); 224 Element properties = dom.createElement("properties");
225 nodeElem.appendChild(properties); 225 nodeElem.appendChild(properties);
276 setNodeProperty(node, property.getKey(), property.getValue()); 276 setNodeProperty(node, property.getKey(), property.getValue());
277 } 277 }
278 } 278 }
279 279
280 private void readNodeProperties(Node node) { 280 private void readNodeProperties(Node node) {
281 NodeFieldAccessor[] fields = node.getNodeClass().getFields(); 281 NodeFieldAccessor[] fields = NodeClass.get(node).getFields();
282 for (NodeFieldAccessor field : fields) { 282 for (NodeFieldAccessor field : fields) {
283 if (field.getKind() == NodeFieldKind.DATA) { 283 if (field.getKind() == NodeFieldKind.DATA) {
284 String key = field.getName(); 284 String key = field.getName();
285 if (getPropertyElement(node, key) == null) { 285 if (getPropertyElement(node, key) == null) {
286 Object value = field.loadValue(node); 286 Object value = field.loadValue(node);
321 if (null == graphElement) { 321 if (null == graphElement) {
322 beginGraph("truffle tree"); 322 beginGraph("truffle tree");
323 } 323 }
324 324
325 // if node is visited once again, skip 325 // if node is visited once again, skip
326 if (getElementByObject(node) != null && NodeUtil.findAnnotation(node.getClass(), GraphDuplicate.class) == null) { 326 if (getElementByObject(node) != null) {
327 return this; 327 return this;
328 } 328 }
329 329
330 // respect node's custom handler 330 // respect node's custom handler
331 if (NodeUtil.findAnnotation(node.getClass(), CustomGraphPrintHandler.class) != null) { 331 if (NodeUtil.findAnnotation(node.getClass(), CustomGraphPrintHandler.class) != null) {
353 return this; 353 return this;
354 } 354 }
355 355
356 private static LinkedHashMap<String, Node> findNamedNodeChildren(Node node) { 356 private static LinkedHashMap<String, Node> findNamedNodeChildren(Node node) {
357 LinkedHashMap<String, Node> nodes = new LinkedHashMap<>(); 357 LinkedHashMap<String, Node> nodes = new LinkedHashMap<>();
358 NodeClass nodeClass = node.getNodeClass(); 358 NodeClass nodeClass = NodeClass.get(node);
359 359
360 for (NodeFieldAccessor field : nodeClass.getFields()) { 360 for (NodeFieldAccessor field : nodeClass.getFields()) {
361 NodeFieldKind kind = field.getKind(); 361 NodeFieldKind kind = field.getKind();
362 if (kind == NodeFieldKind.CHILD || kind == NodeFieldKind.CHILDREN) { 362 if (kind == NodeFieldKind.CHILD || kind == NodeFieldKind.CHILDREN) {
363 Object value = field.loadValue(node); 363 Object value = field.loadValue(node);
401 public interface GraphPrintHandler { 401 public interface GraphPrintHandler {
402 402
403 void visit(Object node, GraphPrintAdapter gPrinter); 403 void visit(Object node, GraphPrintAdapter gPrinter);
404 } 404 }
405 405
406 public interface ChildSupplier {
407
408 /** Supplies an additional child if available. */
409 Object startNode(Object callNode);
410
411 void endNode(Object callNode);
412
413 }
414
415 @Retention(RetentionPolicy.RUNTIME) 406 @Retention(RetentionPolicy.RUNTIME)
416 @Target(ElementType.TYPE) 407 @Target(ElementType.TYPE)
417 public @interface CustomGraphPrintHandler { 408 public @interface CustomGraphPrintHandler {
418 409
419 Class<? extends GraphPrintHandler> handler(); 410 Class<? extends GraphPrintHandler> handler();
421 412
422 @Retention(RetentionPolicy.RUNTIME) 413 @Retention(RetentionPolicy.RUNTIME)
423 @Target(ElementType.TYPE) 414 @Target(ElementType.TYPE)
424 public @interface NullGraphPrintHandler { 415 public @interface NullGraphPrintHandler {
425 } 416 }
426
427 @Retention(RetentionPolicy.RUNTIME)
428 @Target(ElementType.TYPE)
429 public @interface GraphDuplicate {
430 }
431
432 @Retention(RetentionPolicy.RUNTIME)
433 @Target(ElementType.FIELD)
434 public @interface HiddenField {
435 }
436 } 417 }