Search in sources :

Example 6 with RootNode

use of com.oracle.truffle.api.nodes.RootNode in project graal by oracle.

the class OptimizedOSRLoopNode method compileImpl.

private OptimizedCallTarget compileImpl(VirtualFrame frame) {
    RootNode root = getRootNode();
    Node parent = getParent();
    if (speculationLog == null) {
        speculationLog = GraalTruffleRuntime.getRuntime().createSpeculationLog();
    }
    OptimizedCallTarget osrTarget = (OptimizedCallTarget) GraalTruffleRuntime.getRuntime().createCallTarget(createRootNodeImpl(root, frame.getClass()));
    osrTarget.setSpeculationLog(speculationLog);
    // let the old parent re-adopt the children
    parent.adoptChildren();
    osrTarget.compile();
    return osrTarget;
}
Also used : RootNode(com.oracle.truffle.api.nodes.RootNode) Node(com.oracle.truffle.api.nodes.Node) LoopNode(com.oracle.truffle.api.nodes.LoopNode) RootNode(com.oracle.truffle.api.nodes.RootNode) RepeatingNode(com.oracle.truffle.api.nodes.RepeatingNode)

Example 7 with RootNode

use of com.oracle.truffle.api.nodes.RootNode in project graal by oracle.

the class OptimizedOSRLoopNode method forceOSR.

/**
 * Forces OSR compilation for this loop.
 */
public final void forceOSR() {
    baseLoopCount = getThreshold();
    RootNode rootNode = getRootNode();
    VirtualFrame dummyFrame = Truffle.getRuntime().createVirtualFrame(new Object[0], rootNode != null ? rootNode.getFrameDescriptor() : new FrameDescriptor());
    compileLoop(dummyFrame);
}
Also used : VirtualFrame(com.oracle.truffle.api.frame.VirtualFrame) FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) RootNode(com.oracle.truffle.api.nodes.RootNode)

Example 8 with RootNode

use of com.oracle.truffle.api.nodes.RootNode 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);
        }
    }
}
Also used : RootNode(com.oracle.truffle.api.nodes.RootNode) RootCallTarget(com.oracle.truffle.api.RootCallTarget) CallTarget(com.oracle.truffle.api.CallTarget) Node(com.oracle.truffle.api.nodes.Node) RootNode(com.oracle.truffle.api.nodes.RootNode)

Example 9 with RootNode

use of com.oracle.truffle.api.nodes.RootNode in project graal by oracle.

the class GraalTVMCI method reportPolymorphicSpecialize.

@Override
protected void reportPolymorphicSpecialize(Node source) {
    if (TruffleCompilerOptions.getValue(TruffleCompilerOptions.TruffleExperimentalSplitting)) {
        TruffleSplittingStrategy.newPolymorphicSpecialize(source);
        final RootNode rootNode = source.getRootNode();
        final OptimizedCallTarget callTarget = rootNode == null ? null : (OptimizedCallTarget) rootNode.getCallTarget();
        if (callTarget != null) {
            callTarget.polymorphicSpecialize(source);
        }
    }
}
Also used : RootNode(com.oracle.truffle.api.nodes.RootNode)

Example 10 with RootNode

use of com.oracle.truffle.api.nodes.RootNode in project graal by oracle.

the class DebugStackFrame method wrapHeapValue.

DebugValue wrapHeapValue(Object result) {
    LanguageInfo language;
    RootNode root = findCurrentRoot();
    if (root != null) {
        language = root.getLanguageInfo();
    } else {
        language = null;
    }
    return new HeapValue(event.getSession().getDebugger(), language, null, result);
}
Also used : LanguageInfo(com.oracle.truffle.api.nodes.LanguageInfo) RootNode(com.oracle.truffle.api.nodes.RootNode) HeapValue(com.oracle.truffle.api.debug.DebugValue.HeapValue)

Aggregations

RootNode (com.oracle.truffle.api.nodes.RootNode)86 Test (org.junit.Test)36 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)24 Node (com.oracle.truffle.api.nodes.Node)23 CallTarget (com.oracle.truffle.api.CallTarget)16 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)16 RootCallTarget (com.oracle.truffle.api.RootCallTarget)12 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)12 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)9 Source (com.oracle.truffle.api.source.Source)8 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)8 TruffleRuntime (com.oracle.truffle.api.TruffleRuntime)7 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)6 SourceSection (com.oracle.truffle.api.source.SourceSection)6 LanguageInfo (com.oracle.truffle.api.nodes.LanguageInfo)5 ArrayList (java.util.ArrayList)5 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)4 TruffleContext (com.oracle.truffle.api.TruffleContext)3 TruffleException (com.oracle.truffle.api.TruffleException)3 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)3