本文整理了Java中com.oracle.truffle.api.nodes.Node.toString()
方法的一些代码示例,展示了Node.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.toString()
方法的具体详情如下:
包路径:com.oracle.truffle.api.nodes.Node
类名称:Node
方法名:toString
[英]Converts this node to a textual representation useful for debugging.
[中]将此节点转换为对调试有用的文本表示形式。
代码示例来源:origin: org.graalvm.truffle/truffle-api
@Override
public String toString() {
if (next == null) {
return node.toString();
}
StringBuilder sb = new StringBuilder("[");
LinkedNodes ln = this;
while (ln != null) {
sb.append(ln.node);
sb.append(", ");
ln = ln.next;
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]");
return sb.toString();
}
代码示例来源:origin: org.graalvm.compiler/compiler
@Override
public void onCompilationSuccess(OptimizedCallTarget target, TruffleInlining inliningDecision, GraphInfo graph, CompilationResultInfo result) {
for (Node node : target.nodeIterable(inliningDecision)) {
if (node != null && (node.getCost() == NodeCost.MEGAMORPHIC || node.getCost() == NodeCost.POLYMORPHIC)) {
NodeCost cost = node.getCost();
Map<String, Object> props = new LinkedHashMap<>();
props.put("simpleName", node.getClass().getSimpleName());
props.put("subtree", "\n" + NodeUtil.printCompactTreeToString(node));
String msg = cost == NodeCost.MEGAMORPHIC ? "megamorphic" : "polymorphic";
runtime.logEvent(0, msg, node.toString(), props);
}
}
}
代码示例来源:origin: org.graalvm.regex/regex
@TruffleBoundary
@Override
public String toString() {
if (body instanceof InstrumentableNode.WrapperNode) {
return ((InstrumentableNode.WrapperNode) body).getDelegateNode().toString();
}
return body.toString();
}
}
代码示例来源:origin: org.graalvm.compiler/compiler
@Override
public void nodeProperties(PolymorphicSpecializeGraph graph, PolymorphicSpecializeGraph.DumpNode node, Map<String, ? super Object> properties) {
properties.put("label", node.node.toString());
properties.put("ROOT?", node.node instanceof RootNode);
properties.put("LEAF?", node.edge == null);
properties.put("RootNode", node.node.getRootNode());
properties.putAll(node.node.getDebugProperties());
properties.put("SourceSection", node.node.getSourceSection());
if (Introspection.isIntrospectable(node.node)) {
final List<Introspection.SpecializationInfo> specializations = Introspection.getSpecializations(node.node);
for (Introspection.SpecializationInfo specialization : specializations) {
properties.put(specialization.getMethodName() + ".isActive", specialization.isActive());
properties.put(specialization.getMethodName() + ".isExcluded", specialization.isExcluded());
properties.put(specialization.getMethodName() + ".instances", specialization.getInstances());
}
}
}
代码示例来源:origin: org.graalvm.compiler/compiler
public static void dumpPolymorphicSpecialize(List<Node> toDump, List<OptimizedDirectCallNode> knownCallNodes) {
assert toDump.size() > 0;
assert knownCallNodes.size() > 0;
try (TruffleDebugContext debugContext = openDebugContext()) {
Collections.reverse(toDump);
PolymorphicSpecializeDump.PolymorphicSpecializeGraph graph = new PolymorphicSpecializeDump.PolymorphicSpecializeGraph(knownCallNodes, toDump);
final GraphOutput<PolymorphicSpecializeGraph, ?> output = debugContext.buildOutput(
GraphOutput.newBuilder(new PolymorphicSpecializeDump.PolymorphicSpecializeGraphStructure()).protocolVersion(6, 0));
output.beginGroup(graph, "Polymorphic Specialize [" + knownCallNodes.get(0).getCurrentCallTarget() + "]", "Polymorphic Specialize", null, 0, null);
output.print(graph, null, 0, toDump.get(toDump.size() - 1).toString());
output.endGroup();
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
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", formatLocation(reportedSourceSection));
}
代码示例来源:origin: com.oracle.truffle/truffle-api
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", formatLocation(reportedSourceSection));
}
代码示例来源:origin: com.oracle/truffle
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() : "");
}
内容来源于网络,如有侵权,请联系作者删除!