当前位置: 首页>>代码示例>>Java>>正文


Java Node.getParent方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:GraalTVMCI.java

示例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;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:10,代码来源:TruffleInlining.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:15,代码来源:SomLoop.java

示例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;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:8,代码来源:InvokeOnCache.java

示例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();
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:10,代码来源:PrimitiveCallOrigin.java

示例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);
}
 
开发者ID:cesquivias,项目名称:mumbler,代码行数:28,代码来源:UninitializedDispatchNode.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:15,代码来源:PutAllNode.java

示例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;
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:8,代码来源:IndexDispatch.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:11,代码来源:AbstractWhileNode.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:11,代码来源:WhileInlinedLiteralsNode.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:11,代码来源:IntDownToDoMessageNode.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:11,代码来源:IntToByDoMessageNode.java

示例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);
  }
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:15,代码来源:IntToDoInlinedLiteralsNode.java

示例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();
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:43,代码来源:UninitializedDispatchNode.java


注:本文中的com.oracle.truffle.api.nodes.Node.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。