Search in sources :

Example 1 with SourceStackTraceBailoutException

use of org.graalvm.compiler.code.SourceStackTraceBailoutException 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)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)1 SourceStackTraceBailoutException (org.graalvm.compiler.code.SourceStackTraceBailoutException)1 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)1 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)1 NeverPartOfCompilationTestNode (org.graalvm.compiler.truffle.test.nodes.NeverPartOfCompilationTestNode)1 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)1 Test (org.junit.Test)1