com.oracle.truffle.api.nodes.Node.adoptUnadoptedHelper()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(309)

本文整理了Java中com.oracle.truffle.api.nodes.Node.adoptUnadoptedHelper()方法的一些代码示例,展示了Node.adoptUnadoptedHelper()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.adoptUnadoptedHelper()方法的具体详情如下:
包路径:com.oracle.truffle.api.nodes.Node
类名称:Node
方法名:adoptUnadoptedHelper

Node.adoptUnadoptedHelper介绍

暂无

代码示例

代码示例来源:origin: com.oracle/truffle

private void adoptUnadoptedHelper(final Node newChild) {
  assert newChild != null;
  if (newChild == this) {
    throw new IllegalStateException("The parent of a node can never be the node itself.");
  }
  newChild.parent = this;
  newChild.adoptUnadoptedHelper();
}

代码示例来源: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: org.graalvm.truffle/truffle-api

final void replaceHelper(Node newNode, CharSequence reason) {
  CompilerAsserts.neverPartOfCompilation("do not call Node.replaceHelper from compiled code");
  assert inAtomicBlock();
  if (this.getParent() == null) {
    throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
  }
  // (aw) need to set parent *before* replace, so that (unsynchronized) getRootNode()
  // will always find the root node
  newNode.parent = this.parent;
  if (!NodeUtil.replaceChild(this.parent, this, newNode, true)) {
    this.parent.adoptUnadoptedHelper(newNode);
  }
  reportReplace(this, newNode, reason);
  onReplace(newNode, reason);
}

代码示例来源:origin: com.oracle.truffle/truffle-api

final void replaceHelper(Node newNode, CharSequence reason) {
  CompilerAsserts.neverPartOfCompilation("do not call Node.replaceHelper from compiled code");
  assert inAtomicBlock();
  if (this.getParent() == null) {
    throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
  }
  // (aw) need to set parent *before* replace, so that (unsynchronized) getRootNode()
  // will always find the root node
  newNode.parent = this.parent;
  if (!NodeUtil.replaceChild(this.parent, this, newNode, true)) {
    this.parent.adoptUnadoptedHelper(newNode);
  }
  reportReplace(this, newNode, reason);
  onReplace(newNode, reason);
}

代码示例来源:origin: com.oracle/truffle

final void replaceHelper(Node newNode, CharSequence reason) {
  CompilerAsserts.neverPartOfCompilation();
  assert inAtomicBlock();
  if (this.getParent() == null) {
    throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
  }
  if (sourceSection != null && newNode.getSourceSection() == null) {
    // Pass on the source section to the new node.
    newNode.assignSourceSection(sourceSection);
  }
  // (aw) need to set parent *before* replace, so that (unsynchronized) getRootNode()
  // will always find the root node
  newNode.parent = this.parent;
  if (NodeUtil.replaceChild(this.parent, this, newNode)) {
    this.parent.adoptHelper(newNode);
  } else {
    this.parent.adoptUnadoptedHelper(newNode);
  }
  reportReplace(this, newNode, reason);
  onReplace(newNode, reason);
}

相关文章