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

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

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

Node.adoptHelper介绍

暂无

代码示例

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

/**
 * Method that updates the link to the parent in the specified new child node to this node.
 *
 * @param newChild the new child whose parent should be updated
 * @return the new child
 */
protected final <T extends Node> T insert(final T newChild) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  assert newChild != null;
  adoptHelper(newChild);
  return newChild;
}

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

private void adoptHelper(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;
  if (TruffleOptions.TraceASTJSON) {
    JSONHelper.dumpNewChild(this, newChild);
  }
  newChild.adoptHelper();
}

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

public final void adoptChildren() {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  adoptHelper();
}

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

/**
 * Method that updates the link to the parent in the array of specified new child nodes to this
 * node.
 *
 * @param newChildren the array of new children whose parent should be updated
 * @return the array of new children
 */
protected final <T extends Node> T[] insert(final T[] newChildren) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  assert newChildren != null;
  for (Node newChild : newChildren) {
    adoptHelper(newChild);
  }
  return newChildren;
}

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

/**
 * Inserts an new node into an AST that was already {@link #adoptChildren() adopted} by a
 * {@link #getParent() parent}. The new child needs to be assigned to its {@link Child child}
 * field after insert was called.
 *
 * @param newChild the new child whose parent should be updated
 * @return the new child
 * @since 0.8 or earlier
 */
protected final <T extends Node> T insert(final T newChild) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  if (newChild != null) {
    adoptHelper(newChild);
  }
  return newChild;
}

代码示例来源:origin: org.graalvm.truffle/truffle-api

/**
 * Inserts an new node into an AST that was already {@link #adoptChildren() adopted} by a
 * {@link #getParent() parent}. The new child needs to be assigned to its {@link Child child}
 * field after insert was called.
 *
 * @param newChild the new child whose parent should be updated
 * @return the new child
 * @since 0.8 or earlier
 */
protected final <T extends Node> T insert(final T newChild) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  if (newChild != null) {
    adoptHelper(newChild);
  }
  return newChild;
}

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

/**
 * Inserts new node children into an AST that was already {@link #adoptChildren() adopted} by a
 * {@link #getParent() parent}. The new children need to be assigned to its {@link Children
 * children} field after insert was called.
 *
 * @param newChildren the array of new children whose parent should be updated
 * @return the array of new children
 * @since 0.8 or earlier
 */
protected final <T extends Node> T[] insert(final T[] newChildren) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  if (newChildren != null) {
    for (Node newChild : newChildren) {
      adoptHelper(newChild);
    }
  }
  return newChildren;
}

代码示例来源:origin: org.graalvm.truffle/truffle-api

/**
 * Inserts new node children into an AST that was already {@link #adoptChildren() adopted} by a
 * {@link #getParent() parent}. The new children need to be assigned to its {@link Children
 * children} field after insert was called.
 *
 * @param newChildren the array of new children whose parent should be updated
 * @return the array of new children
 * @since 0.8 or earlier
 */
protected final <T extends Node> T[] insert(final T[] newChildren) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  if (newChildren != null) {
    for (Node newChild : newChildren) {
      adoptHelper(newChild);
    }
  }
  return newChildren;
}

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

private void adoptHelper() {
  Iterable<Node> children = this.getChildren();
  for (Node child : children) {
    if (child != null && child.getParent() != this) {
      this.adoptHelper(child);
    }
  }
}

代码示例来源:origin: org.graalvm.truffle/truffle-api

Node node = (Node) child;
if (node.getParent() != currentNode) {
  currentNode.adoptHelper(node);
  Node node = (Node) child;
  if (node.getParent() != currentNode) {
    currentNode.adoptHelper(node);

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

if (nodeClass.getFieldObject(nodeField, parent) == oldChild) {
  if (adopt) {
    parent.adoptHelper(newChild);
    if (array[i] == oldChild) {
      if (adopt) {
        parent.adoptHelper(newChild);

代码示例来源:origin: org.graalvm.truffle/truffle-api

if (nodeClass.getFieldObject(nodeField, parent) == oldChild) {
  if (adopt) {
    parent.adoptHelper(newChild);
    if (array[i] == oldChild) {
      if (adopt) {
        parent.adoptHelper(newChild);

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

Node node = (Node) child;
if (node.getParent() != currentNode) {
  currentNode.adoptHelper(node);
  Node node = (Node) child;
  if (node.getParent() != currentNode) {
    currentNode.adoptHelper(node);

代码示例来源: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);
}

相关文章