本文整理了Java中com.oracle.truffle.api.nodes.Node.atomic()
方法的一些代码示例,展示了Node.atomic()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.atomic()
方法的具体详情如下:
包路径:com.oracle.truffle.api.nodes.Node
类名称:Node
方法名:atomic
暂无
代码示例来源:origin: com.oracle/truffle
public static <T extends Node & DSLNode> T rewriteUninitialized(final Node uninitialized, final T newNode) {
return uninitialized.atomic(new Callable<T>() {
public T call() {
Node prev = getPrevious(uninitialized);
if (prev == null) {
newNode.adoptChildren0(uninitialized, null);
return uninitialized.replace(newNode, "Uninitialized monomorphic");
} else {
return appendPolymorphic(uninitialized, newNode);
}
}
});
}
代码示例来源:origin: com.oracle/truffle
public static <T extends Node & DSLNode> T rewrite(final Node thisNode, final T newNode, final String message) {
return thisNode.atomic(new Callable<T>() {
public T call() {
assert newNode != null;
if (getNext(thisNode) != null || getPrevious(thisNode) != null) {
// already polymorphic -> append
return appendPolymorphic(findUninitialized(thisNode), newNode);
} else if (includes(thisNode, newNode)) {
// included -> remains monomorphic
newNode.adoptChildren0(thisNode, null);
return thisNode.replace(newNode, message);
} else {
// goto polymorphic
return null;
}
}
});
}
代码示例来源:origin: com.oracle/truffle
public static <T extends Node & DSLNode> T rewriteToPolymorphic(final Node oldNode, final DSLNode uninitializedDSL, final T polymorphic, final DSLNode currentCopy, final DSLNode newNodeDSL,
final String message) {
return oldNode.atomic(new Callable<T>() {
public T call() {
assert getNext(oldNode) == null;
assert getPrevious(oldNode) == null;
assert newNodeDSL != null;
Node uninitialized = (Node) uninitializedDSL;
Node newNode = (Node) newNodeDSL;
polymorphic.adoptChildren0(oldNode, (Node) currentCopy);
updateSourceSection(oldNode, uninitialized);
// new specialization
updateSourceSection(oldNode, newNode);
newNodeDSL.adoptChildren0(null, uninitialized);
currentCopy.adoptChildren0(null, newNode);
oldNode.replace(polymorphic, message);
assert newNode != null ? currentCopy.getNext0() == newNode : currentCopy.getNext0() == uninitialized;
assert uninitializedDSL.getNext0() == null;
return polymorphic;
}
});
}
代码示例来源:origin: org.graalvm.truffle/truffle-api
/**
* Replaces this node with another node. If there is a source section (see
* {@link #getSourceSection()}) associated with this node, it is transferred to the new node.
*
* @param newNode the new node that is the replacement
* @param reason a description of the reason for the replacement
* @return the new node
* @since 0.8 or earlier
*/
public final <T extends Node> T replace(final T newNode, final CharSequence reason) {
CompilerDirectives.transferToInterpreterAndInvalidate();
atomic(new Runnable() {
public void run() {
replaceHelper(newNode, reason);
}
});
return newNode;
}
代码示例来源:origin: com.oracle/truffle
/**
* Replaces this node with another node. If there is a source section (see
* {@link #getSourceSection()}) associated with this node, it is transferred to the new node.
*
* @param newNode the new node that is the replacement
* @param reason a description of the reason for the replacement
* @return the new node
*/
public final <T extends Node> T replace(final T newNode, final CharSequence reason) {
CompilerDirectives.transferToInterpreterAndInvalidate();
atomic(new Runnable() {
public void run() {
replaceHelper(newNode, reason);
}
});
return newNode;
}
代码示例来源:origin: com.oracle.truffle/truffle-api
/**
* Replaces this node with another node. If there is a source section (see
* {@link #getSourceSection()}) associated with this node, it is transferred to the new node.
*
* @param newNode the new node that is the replacement
* @param reason a description of the reason for the replacement
* @return the new node
* @since 0.8 or earlier
*/
public final <T extends Node> T replace(final T newNode, final CharSequence reason) {
CompilerDirectives.transferToInterpreterAndInvalidate();
atomic(new Runnable() {
public void run() {
replaceHelper(newNode, reason);
}
});
return newNode;
}
内容来源于网络,如有侵权,请联系作者删除!