本文整理了Java中com.oracle.truffle.api.nodes.Node.getParent()
方法的一些代码示例,展示了Node.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getParent()
方法的具体详情如下:
包路径:com.oracle.truffle.api.nodes.Node
类名称:Node
方法名:getParent
[英]The current parent node of this node.
[中]此节点的当前父节点。
代码示例来源:origin: com.oracle.truffle/truffle-api
public boolean visit(Node child) {
if (child != null && child.getParent() == null) {
newChild.adoptUnadoptedHelper(child);
}
return true;
}
});
代码示例来源:origin: org.graalvm.truffle/truffle-api
private static boolean isParentOf(Node ch, Node p) {
Node parent = ch.getParent();
while (parent != null) {
if (parent == p) {
return true;
}
parent = parent.getParent();
}
return false;
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
public boolean visit(Node child) {
if (child != null && child.getParent() == null) {
newChild.adoptUnadoptedHelper(child);
}
return true;
}
});
代码示例来源:origin: org.graalvm.compiler/compiler
static int calculateNodeDepth(Node node) {
int depth = 0;
Node traverseNode = node;
while (traverseNode != null) {
depth++;
traverseNode = traverseNode.getParent();
}
return depth;
}
代码示例来源:origin: com.oracle.truffle/truffle-api
final ProbeNode findProbe() {
Node parent = this;
while (parent != null && !(parent instanceof ProbeNode)) {
parent = parent.getParent();
}
return (ProbeNode) parent;
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
final ProbeNode findProbe() {
Node parent = this;
while (parent != null && !(parent instanceof ProbeNode)) {
parent = parent.getParent();
}
return (ProbeNode) parent;
}
代码示例来源:origin: org.graalvm.compiler/compiler
private static void pullOutParentChain(Node node, List<Node> toDump) {
Node rootNode = node;
while (rootNode.getParent() != null) {
toDump.add(rootNode);
rootNode = rootNode.getParent();
}
toDump.add(rootNode);
}
}
代码示例来源:origin: com.oracle/truffle
public static List<Node> collectNodes(Node parent, Node child) {
List<Node> nodes = new ArrayList<>();
Node current = child;
while (current != null) {
nodes.add(current);
if (current == parent) {
return nodes;
}
current = current.getParent();
}
throw new IllegalArgumentException("Node " + parent + " is not a parent of " + child + ".");
}
代码示例来源:origin: com.oracle/truffle
public static <T> T findParent(Node start, Class<T> clazz) {
Node parent = start.getParent();
if (parent == null) {
return null;
} else if (clazz.isInstance(parent)) {
return clazz.cast(parent);
} else {
return findParent(parent, clazz);
}
}
代码示例来源:origin: com.oracle.truffle/truffle-api
/**
* Checks if this node can be replaced by another node: tree structure & type.
*
* @since 0.8 or earlier
*/
public final boolean isSafelyReplaceableBy(Node newNode) {
return NodeUtil.isReplacementSafe(getParent(), this, newNode);
}
代码示例来源:origin: com.oracle.truffle/truffle-api
/** @since 0.8 or earlier */
public static <T> T findParent(Node start, Class<T> clazz) {
Node parent = start.getParent();
if (parent == null) {
return null;
} else if (clazz.isInstance(parent)) {
return clazz.cast(parent);
} else {
return findParent(parent, clazz);
}
}
代码示例来源:origin: com.oracle.truffle/truffle-api
@SuppressWarnings("deprecation")
private static void invalidateWrapper(Node node) {
Node parent = node.getParent();
if (!(parent instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode)) {
// not yet wrapped
return;
}
invalidateWrapperImpl((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) parent, node);
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
/** @since 0.8 or earlier */
public static <T> T findParent(Node start, Class<T> clazz) {
Node parent = start.getParent();
if (parent == null) {
return null;
} else if (clazz.isInstance(parent)) {
return clazz.cast(parent);
} else {
return findParent(parent, clazz);
}
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
@SuppressWarnings("deprecation")
private static void invalidateWrapper(Node node) {
Node parent = node.getParent();
if (!(parent instanceof com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode)) {
// not yet wrapped
return;
}
invalidateWrapperImpl((com.oracle.truffle.api.instrumentation.InstrumentableFactory.WrapperNode) parent, node);
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
/**
* Checks if this node can be replaced by another node: tree structure & type.
*
* @since 0.8 or earlier
*/
public final boolean isSafelyReplaceableBy(Node newNode) {
return NodeUtil.isReplacementSafe(getParent(), this, newNode);
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
private static Node findParentTaggedNode(Node node, Set<Class<? extends Tag>> tags) {
if (isTaggedWith(node, tags)) {
return node;
}
Node parent = node.getParent();
if (parent == null) {
return null;
}
return findParentTaggedNode(parent, tags);
}
代码示例来源:origin: com.oracle/truffle
private void adoptUnadoptedHelper() {
Iterable<Node> children = this.getChildren();
for (Node child : children) {
if (child != null && child.getParent() == null) {
this.adoptUnadoptedHelper(child);
}
}
}
代码示例来源:origin: com.oracle.truffle/truffle-api
private static Node findParentTaggedNode(Node node, Set<Class<? extends Tag>> tags) {
if (isTaggedWith(node, tags)) {
return node;
}
Node parent = node.getParent();
if (parent == null) {
return null;
}
return findParentTaggedNode(parent, tags);
}
代码示例来源:origin: com.oracle/truffle
public static boolean verify(Node root) {
Iterable<Node> children = root.getChildren();
for (Node child : children) {
if (child != null) {
if (child.getParent() != root) {
throw new AssertionError(toStringWithClass(child) + ": actual parent=" + toStringWithClass(child.getParent()) + " expected parent=" + toStringWithClass(root));
}
verify(child);
}
}
return true;
}
代码示例来源:origin: org.graalvm.compiler/compiler
private static String extractSourceSection(OptimizedDirectCallNode node) {
Node cnode = node;
while (cnode.getSourceSection() == null && !(cnode instanceof RootNode)) {
cnode = cnode.getParent();
if (cnode == null) {
return "";
}
}
return getShortDescription(cnode.getSourceSection());
}
内容来源于网络,如有侵权,请联系作者删除!