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

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

本文整理了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

  1. /**
  2. * Method that updates the link to the parent in the specified new child node to this node.
  3. *
  4. * @param newChild the new child whose parent should be updated
  5. * @return the new child
  6. */
  7. protected final <T extends Node> T insert(final T newChild) {
  8. CompilerDirectives.transferToInterpreterAndInvalidate();
  9. assert newChild != null;
  10. adoptHelper(newChild);
  11. return newChild;
  12. }

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

  1. private void adoptHelper(final Node newChild) {
  2. assert newChild != null;
  3. if (newChild == this) {
  4. throw new IllegalStateException("The parent of a node can never be the node itself.");
  5. }
  6. newChild.parent = this;
  7. if (TruffleOptions.TraceASTJSON) {
  8. JSONHelper.dumpNewChild(this, newChild);
  9. }
  10. newChild.adoptHelper();
  11. }

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

  1. public final void adoptChildren() {
  2. CompilerDirectives.transferToInterpreterAndInvalidate();
  3. adoptHelper();
  4. }

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

  1. /**
  2. * Method that updates the link to the parent in the array of specified new child nodes to this
  3. * node.
  4. *
  5. * @param newChildren the array of new children whose parent should be updated
  6. * @return the array of new children
  7. */
  8. protected final <T extends Node> T[] insert(final T[] newChildren) {
  9. CompilerDirectives.transferToInterpreterAndInvalidate();
  10. assert newChildren != null;
  11. for (Node newChild : newChildren) {
  12. adoptHelper(newChild);
  13. }
  14. return newChildren;
  15. }

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

  1. /**
  2. * Inserts an new node into an AST that was already {@link #adoptChildren() adopted} by a
  3. * {@link #getParent() parent}. The new child needs to be assigned to its {@link Child child}
  4. * field after insert was called.
  5. *
  6. * @param newChild the new child whose parent should be updated
  7. * @return the new child
  8. * @since 0.8 or earlier
  9. */
  10. protected final <T extends Node> T insert(final T newChild) {
  11. CompilerDirectives.transferToInterpreterAndInvalidate();
  12. if (newChild != null) {
  13. adoptHelper(newChild);
  14. }
  15. return newChild;
  16. }

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

  1. /**
  2. * Inserts an new node into an AST that was already {@link #adoptChildren() adopted} by a
  3. * {@link #getParent() parent}. The new child needs to be assigned to its {@link Child child}
  4. * field after insert was called.
  5. *
  6. * @param newChild the new child whose parent should be updated
  7. * @return the new child
  8. * @since 0.8 or earlier
  9. */
  10. protected final <T extends Node> T insert(final T newChild) {
  11. CompilerDirectives.transferToInterpreterAndInvalidate();
  12. if (newChild != null) {
  13. adoptHelper(newChild);
  14. }
  15. return newChild;
  16. }

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

  1. /**
  2. * Inserts new node children into an AST that was already {@link #adoptChildren() adopted} by a
  3. * {@link #getParent() parent}. The new children need to be assigned to its {@link Children
  4. * children} field after insert was called.
  5. *
  6. * @param newChildren the array of new children whose parent should be updated
  7. * @return the array of new children
  8. * @since 0.8 or earlier
  9. */
  10. protected final <T extends Node> T[] insert(final T[] newChildren) {
  11. CompilerDirectives.transferToInterpreterAndInvalidate();
  12. if (newChildren != null) {
  13. for (Node newChild : newChildren) {
  14. adoptHelper(newChild);
  15. }
  16. }
  17. return newChildren;
  18. }

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

  1. /**
  2. * Inserts new node children into an AST that was already {@link #adoptChildren() adopted} by a
  3. * {@link #getParent() parent}. The new children need to be assigned to its {@link Children
  4. * children} field after insert was called.
  5. *
  6. * @param newChildren the array of new children whose parent should be updated
  7. * @return the array of new children
  8. * @since 0.8 or earlier
  9. */
  10. protected final <T extends Node> T[] insert(final T[] newChildren) {
  11. CompilerDirectives.transferToInterpreterAndInvalidate();
  12. if (newChildren != null) {
  13. for (Node newChild : newChildren) {
  14. adoptHelper(newChild);
  15. }
  16. }
  17. return newChildren;
  18. }

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

  1. private void adoptHelper() {
  2. Iterable<Node> children = this.getChildren();
  3. for (Node child : children) {
  4. if (child != null && child.getParent() != this) {
  5. this.adoptHelper(child);
  6. }
  7. }
  8. }

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

  1. Node node = (Node) child;
  2. if (node.getParent() != currentNode) {
  3. currentNode.adoptHelper(node);
  4. Node node = (Node) child;
  5. if (node.getParent() != currentNode) {
  6. currentNode.adoptHelper(node);

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

  1. if (nodeClass.getFieldObject(nodeField, parent) == oldChild) {
  2. if (adopt) {
  3. parent.adoptHelper(newChild);
  4. if (array[i] == oldChild) {
  5. if (adopt) {
  6. parent.adoptHelper(newChild);

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

  1. if (nodeClass.getFieldObject(nodeField, parent) == oldChild) {
  2. if (adopt) {
  3. parent.adoptHelper(newChild);
  4. if (array[i] == oldChild) {
  5. if (adopt) {
  6. parent.adoptHelper(newChild);

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

  1. Node node = (Node) child;
  2. if (node.getParent() != currentNode) {
  3. currentNode.adoptHelper(node);
  4. Node node = (Node) child;
  5. if (node.getParent() != currentNode) {
  6. currentNode.adoptHelper(node);

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

  1. final void replaceHelper(Node newNode, CharSequence reason) {
  2. CompilerAsserts.neverPartOfCompilation();
  3. assert inAtomicBlock();
  4. if (this.getParent() == null) {
  5. throw new IllegalStateException("This node cannot be replaced, because it does not yet have a parent.");
  6. }
  7. if (sourceSection != null && newNode.getSourceSection() == null) {
  8. // Pass on the source section to the new node.
  9. newNode.assignSourceSection(sourceSection);
  10. }
  11. // (aw) need to set parent *before* replace, so that (unsynchronized) getRootNode()
  12. // will always find the root node
  13. newNode.parent = this.parent;
  14. if (NodeUtil.replaceChild(this.parent, this, newNode)) {
  15. this.parent.adoptHelper(newNode);
  16. } else {
  17. this.parent.adoptUnadoptedHelper(newNode);
  18. }
  19. reportReplace(this, newNode, reason);
  20. onReplace(newNode, reason);
  21. }

相关文章