Search in sources :

Example 1 with LoopNode

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

the class OptimizedCallTargetTest method testCompileOnly5.

@Test
public void testCompileOnly5() {
    // OSR should trigger if compile-only with excludes
    try (TruffleOptionsOverrideScope scope = TruffleCompilerOptions.overrideOptions(TruffleCompileOnly, "~foobar")) {
        final OSRRepeatingNode repeating = new OSRRepeatingNode(TruffleCompilerOptions.getValue(TruffleOSRCompilationThreshold));
        final LoopNode loop = runtime.createLoopNode(repeating);
        OptimizedCallTarget target = (OptimizedCallTarget) runtime.createCallTarget(new NamedRootNode("foobar") {

            @Child
            LoopNode loopChild = loop;

            @Override
            public Object execute(VirtualFrame frame) {
                loopChild.executeLoop(frame);
                return super.execute(frame);
            }
        });
        target.call();
        OptimizedCallTarget osrTarget = findOSRTarget(loop);
        assertCompiled(osrTarget);
    }
}
Also used : LoopNode(com.oracle.truffle.api.nodes.LoopNode) OptimizedOSRLoopNode(org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode) VirtualFrame(com.oracle.truffle.api.frame.VirtualFrame) TruffleOptionsOverrideScope(org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) Test(org.junit.Test)

Example 2 with LoopNode

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

the class OptimizedCallTargetTest method testCompileOnly4.

@Test
public void testCompileOnly4() {
    // OSR should not trigger for compile-only includes
    try (TruffleOptionsOverrideScope scope = TruffleCompilerOptions.overrideOptions(TruffleCompileOnly, "foobar")) {
        final OSRRepeatingNode repeating = new OSRRepeatingNode(TruffleCompilerOptions.getValue(TruffleOSRCompilationThreshold));
        final LoopNode loop = runtime.createLoopNode(repeating);
        OptimizedCallTarget target = (OptimizedCallTarget) runtime.createCallTarget(new NamedRootNode("foobar") {

            @Child
            LoopNode loopChild = loop;

            @Override
            public Object execute(VirtualFrame frame) {
                loopChild.executeLoop(frame);
                return super.execute(frame);
            }
        });
        target.call();
        OptimizedCallTarget osrTarget = findOSRTarget(loop);
        if (osrTarget != null) {
            assertNotCompiled(osrTarget);
        }
    }
}
Also used : LoopNode(com.oracle.truffle.api.nodes.LoopNode) OptimizedOSRLoopNode(org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode) VirtualFrame(com.oracle.truffle.api.frame.VirtualFrame) TruffleOptionsOverrideScope(org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) Test(org.junit.Test)

Aggregations

VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)2 LoopNode (com.oracle.truffle.api.nodes.LoopNode)2 TruffleOptionsOverrideScope (org.graalvm.compiler.truffle.common.TruffleCompilerOptions.TruffleOptionsOverrideScope)2 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)2 OptimizedOSRLoopNode (org.graalvm.compiler.truffle.runtime.OptimizedOSRLoopNode)2 Test (org.junit.Test)2