Search in sources :

Example 21 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method addConstants.

@Test
public void addConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new AddTestNode(new ConstantTestNode(40), new ConstantTestNode(2));
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "addConstants", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Example 22 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method allowedRecursion.

@Test
public void allowedRecursion() {
    /* Recursion depth just below the threshold that reports it as too deep recursion. */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new RecursionTestNode(TruffleCompilerOptions.getValue(PEGraphDecoder.Options.InliningDepthError) - 5);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "allowedRecursion", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) RecursionTestNode(org.graalvm.compiler.truffle.test.nodes.RecursionTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 23 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method constantValue.

@Test
public void constantValue() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new ConstantTestNode(42);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "constantValue", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 24 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method neverPartOfCompilationTest.

@Test
public void neverPartOfCompilationTest() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode firstTree = new NeverPartOfCompilationTestNode(new ConstantTestNode(1), 2);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "neverPartOfCompilationTest", firstTree));
    AbstractTestNode secondTree = new NeverPartOfCompilationTestNode(new ConstantTestNode(1), 1);
    try {
        assertPartialEvalEquals("constant42", new RootTestNode(fd, "neverPartOfCompilationTest", secondTree));
        Assert.fail("Expected verification error!");
    } catch (SourceStackTraceBailoutException t) {
        // Expected verification error occurred.
        StackTraceElement[] trace = t.getStackTrace();
        assertStack(trace[0], "org.graalvm.compiler.truffle.test.nodes.NeverPartOfCompilationTestNode", "execute", "NeverPartOfCompilationTestNode.java");
        if (!truffleCompiler.getPartialEvaluator().getConfigForParsing().trackNodeSourcePosition() && !GraalOptions.TrackNodeSourcePosition.getValue(getInitialOptions())) {
            assertStack(trace[1], "org.graalvm.compiler.truffle.test.nodes.RootTestNode", "execute", "RootTestNode.java");
        } else {
        // When NodeSourcePosition tracking is enabled, a smaller stack trace is produced
        }
    }
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) SourceStackTraceBailoutException(org.graalvm.compiler.code.SourceStackTraceBailoutException) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) NeverPartOfCompilationTestNode(org.graalvm.compiler.truffle.test.nodes.NeverPartOfCompilationTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 25 with RootTestNode

use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.

the class SimplePartialEvaluationTest method loopExplosionPhi.

@Test
public void loopExplosionPhi() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new LoopExplosionPhiNode();
    RootNode rootNode = new RootTestNode(fd, "loopExplosionPhi", result);
    OptimizedCallTarget compilable = compileHelper("loopExplosionPhi", rootNode, new Object[0]);
    Assert.assertEquals(1, compilable.call(new Object[0]));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) RootNode(com.oracle.truffle.api.nodes.RootNode) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) LoopExplosionPhiNode(org.graalvm.compiler.truffle.test.nodes.LoopExplosionPhiNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)50 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)50 Test (org.junit.Test)48 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)43 OptimizedCallTarget (org.graalvm.compiler.truffle.runtime.OptimizedCallTarget)14 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)14 RootNode (com.oracle.truffle.api.nodes.RootNode)10 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)7 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)6 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)5 Assumption (com.oracle.truffle.api.Assumption)3 LoadLocalTestNode (org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode)3 NestedExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode)3 StoreLocalTestNode (org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode)3 CallTarget (com.oracle.truffle.api.CallTarget)2 RootCallTarget (com.oracle.truffle.api.RootCallTarget)2 WeakReference (java.lang.ref.WeakReference)2 IntSupplier (java.util.function.IntSupplier)2 BailoutException (jdk.vm.ci.code.BailoutException)2 InstrumentPhase (org.graalvm.compiler.truffle.compiler.phases.InstrumentPhase)2