use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class GraalTVMCI method onLoopCount.
@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);
}
}
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class CachedReachableFallbackTest method countGuardNodes.
private static int countGuardNodes(Node searchNode) {
AtomicInteger count = new AtomicInteger(0);
searchNode.accept(new NodeVisitor() {
public boolean visit(Node node) {
if (node instanceof GuardNode) {
count.incrementAndGet();
return false;
}
return true;
}
});
return count.get();
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class CachedTest method testChildrenAdoption7.
@Test
public void testChildrenAdoption7() {
ChildrenAdoption7 root = createNode(ChildrenAdoption7Factory.getInstance(), false);
Node child = new ValueNode();
root.execute(child);
Assert.assertTrue(hasParent(root, child));
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class CachedTest method testChildrenAdoption4.
@Test
public void testChildrenAdoption4() {
ChildrenAdoption4 root = createNode(ChildrenAdoption4Factory.getInstance(), false);
Node child = new ValueNode();
root.execute(child);
Assert.assertTrue(hasParent(root, child));
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class DebugStackFrame method findCurrentRoot.
RootNode findCurrentRoot() {
SuspendedContext context = getContext();
if (currentFrame == null) {
return context.getInstrumentedNode().getRootNode();
} else {
Node callNode = currentFrame.getCallNode();
if (callNode != null) {
return callNode.getRootNode();
}
CallTarget target = currentFrame.getCallTarget();
if (target instanceof RootCallTarget) {
return ((RootCallTarget) target).getRootNode();
}
return null;
}
}
Aggregations