use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class OptimizedCallTarget method pullOutParentChain.
private static void pullOutParentChain(Node node, List<Node> toDump) {
Node rootNode = node;
while (rootNode.getParent() != null) {
toDump.add(rootNode);
rootNode = rootNode.getParent();
}
toDump.add(rootNode);
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class TruffleInlining method getCallNodes.
private static List<OptimizedDirectCallNode> getCallNodes(OptimizedCallTarget target) {
final List<OptimizedDirectCallNode> callNodes = new ArrayList<>();
target.getRootNode().accept(new NodeVisitor() {
@Override
public boolean visit(Node node) {
if (node instanceof OptimizedDirectCallNode) {
callNodes.add((OptimizedDirectCallNode) node);
}
return true;
}
});
return callNodes;
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class TruffleInlining method getPosition.
@Override
public SourceLanguagePosition getPosition(JavaConstant node) {
SnippetReflectionProvider snippetReflection = runtime().getGraalRuntime().getRequiredCapability(SnippetReflectionProvider.class);
Node truffleNode = snippetReflection.asObject(Node.class, node);
if (truffleNode == null) {
return null;
}
SourceSection section = null;
if (truffleNode instanceof DirectCallNode) {
section = ((DirectCallNode) truffleNode).getCurrentRootNode().getSourceSection();
}
if (section == null) {
section = truffleNode.getSourceSection();
}
if (section == null) {
Node cur = truffleNode.getParent();
while (cur != null) {
section = cur.getSourceSection();
if (section != null) {
break;
}
cur = cur.getParent();
}
}
if (section != null) {
return new TruffleSourceLanguagePosition(section);
}
return null;
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class NodeAdoptionBenchmark method shallowBigBlocks.
@Benchmark
public Object shallowBigBlocks() {
Node block = createBlock(0, 30);
block.adoptChildren();
return block;
}
use of com.oracle.truffle.api.nodes.Node in project graal by oracle.
the class DebuggerSessionSnippets method evalInContext.
/**
* Evaluates a snippet of code in a halted execution context. Assumes frame is part of the
* current execution stack, behavior is undefined if not.
*
* @param ev event notification where execution is halted
* @param code text of the code to be executed
* @param frameInstance frame where execution is halted
* @return
* @throws IOException
*/
static Object evalInContext(SuspendedEvent ev, String code, FrameInstance frameInstance) throws IOException {
try {
Node node;
MaterializedFrame frame;
if (frameInstance == null) {
node = ev.getContext().getInstrumentedNode();
frame = ev.getMaterializedFrame();
} else {
node = frameInstance.getCallNode();
frame = frameInstance.getFrame(FrameAccess.MATERIALIZE).materialize();
}
return Debugger.ACCESSOR.evalInContext(node, frame, code);
} catch (KillException kex) {
throw new IOException("Evaluation was killed.", kex);
}
}
Aggregations