本文整理汇总了Java中com.oracle.truffle.api.nodes.Node.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getParent方法的具体用法?Java Node.getParent怎么用?Java Node.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.oracle.truffle.api.nodes.Node
的用法示例。
在下文中一共展示了Node.getParent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
@Override
public void onLoopCount(Node source, int count) {
Node node = source;
Node parentNode = source != null ? source.getParent() : null;
while (node != null) {
if (node instanceof OptimizedOSRLoopNode) {
((OptimizedOSRLoopNode) node).reportChildLoopCount(count);
}
parentNode = node;
node = node.getParent();
}
if (parentNode != null && parentNode instanceof RootNode) {
CallTarget target = ((RootNode) parentNode).getCallTarget();
if (target instanceof OptimizedCallTarget) {
((OptimizedCallTarget) target).onLoopCount(count);
}
}
}
示例2: calculateNodeDepth
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
static int calculateNodeDepth(Node node) {
int depth = 0;
Node traverseNode = node;
while (traverseNode != null) {
depth++;
traverseNode = traverseNode.getParent();
}
return depth;
}
示例3: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
public static void reportLoopCount(final long count, final Node loopNode) {
if (count < 1) {
return;
}
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = loopNode.getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutMethodScope(count);
}
}
示例4: determineChainHead
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
private InvokeOnCache determineChainHead() {
Node i = this;
while (i.getParent() instanceof InvokeOnCache) {
i = i.getParent();
}
return (InvokeOnCache) i;
}
示例5: getCaller
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
public static SourceSection getCaller() {
Node directCallNode = getCallerNode();
Node current = directCallNode;
while (!(current instanceof GenericMessageSendNode)) {
current = current.getParent();
}
return current.getSourceSection();
}
示例6: executeDispatch
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
@Override
protected Object executeDispatch(VirtualFrame virtualFrame,
CallTarget callTarget, Object[] arguments) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Node cur = this;
int size = 0;
while (cur.getParent() instanceof DispatchNode) {
cur = cur.getParent();
size++;
}
InvokeNode invokeNode = (InvokeNode) cur.getParent();
DispatchNode replacement;
if (size < INLINE_CACHE_SIZE) {
// There's still room in the cache. Add a new DirectDispatchNode.
DispatchNode next = new UninitializedDispatchNode();
replacement = new DirectDispatchNode(next, callTarget);
this.replace(replacement);
} else {
replacement = new GenericDispatchNode();
invokeNode.dispatchNode.replace(replacement);
}
// Call function with newly created dispatch node.
return replacement.executeDispatch(virtualFrame, callTarget, arguments);
}
示例7: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
protected final void reportLoopCount(final long count) {
if (count == 0) {
return;
}
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例8: determineChainHead
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
private IndexDispatch determineChainHead() {
Node i = this;
while (i.getParent() instanceof IndexDispatch) {
i = i.getParent();
}
return (IndexDispatch) i;
}
示例9: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
protected final void reportLoopCount(final long count) {
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例10: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
protected void reportLoopCount(final long count) {
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例11: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
private void reportLoopCount(final long count) {
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例12: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
protected final void reportLoopCount(final long count) {
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof Invokable)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例13: reportLoopCount
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
private void reportLoopCount(final long count) {
if (count < 1) {
return;
}
CompilerAsserts.neverPartOfCompilation("reportLoopCount");
Node current = getParent();
while (current != null && !(current instanceof RootNode)) {
current = current.getParent();
}
if (current != null) {
((Invokable) current).propagateLoopCountThroughoutLexicalScope(count);
}
}
示例14: specialize
import com.oracle.truffle.api.nodes.Node; //导入方法依赖的package包/类
private AbstractDispatchNode specialize(final Object[] arguments) {
// Determine position in dispatch node chain, i.e., size of inline cache
Node i = this;
int chainDepth = 0;
while (i.getParent() instanceof AbstractDispatchNode) {
i = i.getParent();
if (!(i instanceof WrapperNode)) {
chainDepth++;
}
}
AbstractDispatchNode first = (AbstractDispatchNode) i;
// First we need is to make sure the object layout is up to date.
// If the object's layout was updated, we rerun the lookup chain
// to make sure we hit a cached item of the new layout. Otherwise we could
// add multiple.
// TODO: this means objects are only migrated to the new shape on the
// very slow path, I think this is ok, because we do not expect
// many shape transitions. But, is this true?
// TODO: this approach is recursive, and we might run out of Java stack.
// convert it to iterative approach, perhaps by exposing the guards
// and checking them directly to find matching node
Object receiver = arguments[0];
if (receiver instanceof SObject) {
SObject rcvr = (SObject) receiver;
if (!rcvr.isLayoutCurrent()) {
ObjectTransitionSafepoint.INSTANCE.transitionObject(rcvr);
if (first != this) { // if first is this, short cut and directly continue...
return first;
}
}
}
// we modify a dispatch chain here, so, better grab the root node before we do anything
Lock lock = getLock();
try {
lock.lock();
return specialize(arguments, chainDepth, first);
} finally {
lock.unlock();
}
}