public String getShortDescription() { final String location = sourceSection == null ? "<unknown>" : sourceSection.getShortDescription(); return "Probe@" + location + getTagsDescription(); }
public String displaySourceLocation(Node node) { if (node == null) { return "<unknown>"; } SourceSection section = node.getSourceSection(); boolean estimated = false; if (section == null) { section = node.getEncapsulatingSourceSection(); estimated = true; } return section.getShortDescription() + (estimated ? "~" : ""); }
private static String displaySourceAttribution(Node node) { final SourceSection section = node.getSourceSection(); if (section instanceof NullSourceSection) { return "source: " + section.getShortDescription(); } if (section != null) { final String srcText = section.getCode(); final StringBuilder sb = new StringBuilder(); sb.append("source:"); sb.append(" (" + section.getCharIndex() + "," + (section.getCharEndIndex() - 1) + ")"); sb.append(" line=" + section.getLineLocation().getLineNumber()); sb.append(" len=" + srcText.length()); sb.append(" text=\"" + srcText + "\""); return sb.toString(); } return ""; }
static void traceRewrite(Node oldNode, Node newNode, CharSequence reason) { if (TruffleOptions.TraceRewritesFilterFromCost != null) { if (filterByKind(oldNode, TruffleOptions.TraceRewritesFilterFromCost)) { return; } } if (TruffleOptions.TraceRewritesFilterToCost != null) { if (filterByKind(newNode, TruffleOptions.TraceRewritesFilterToCost)) { return; } } String filter = TruffleOptions.TraceRewritesFilterClass; Class<? extends Node> from = oldNode.getClass(); Class<? extends Node> to = newNode.getClass(); if (filter != null && (filterByContainsClassName(from, filter) || filterByContainsClassName(to, filter))) { return; } final SourceSection reportedSourceSection = oldNode.getEncapsulatingSourceSection(); PrintStream out = System.out; out.printf("[truffle] rewrite %-50s |From %-40s |To %-40s |Reason %s%s%n", oldNode.toString(), formatNodeInfo(oldNode), formatNodeInfo(newNode), reason != null && reason.length() > 0 ? reason : "unknown", reportedSourceSection != null ? " at " + reportedSourceSection.getShortDescription() : ""); }