Search in sources :

Example 6 with RootTestNode

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

the class CastExactPartialEvaluationTest method testCommon.

private void testCommon(AbstractTestNode testNode, String testName) {
    FrameDescriptor fd = new FrameDescriptor();
    RootNode rootNode = new RootTestNode(fd, testName, testNode);
    RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
    Assert.assertEquals(42, callTarget.call(newBuffer()));
    assertPartialEvalNoInvokes(callTarget, new Object[] { newBuffer() });
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) RootNode(com.oracle.truffle.api.nodes.RootNode) RootCallTarget(com.oracle.truffle.api.RootCallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode)

Example 7 with RootTestNode

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

the class CompilationFinalPartialEvaluationTest method compilationFinalTest1.

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

Example 8 with RootTestNode

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

the class CompilerAssertsTest method compilationConstantTest.

@Test
public void compilationConstantTest() {
    FrameDescriptor descriptor = new FrameDescriptor();
    CompilationConstantTestNode result = new CompilationConstantTestNode(new ConstantTestNode(5));
    RootTestNode rootNode = new RootTestNode(descriptor, "compilationConstant", result);
    compileHelper("compilationConstant", rootNode, new Object[0]);
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) NonConstantTestNode(org.graalvm.compiler.truffle.test.nodes.NonConstantTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 9 with RootTestNode

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

the class CompilerAssertsTest method neverPartOfCompilationTest.

@Test
public void neverPartOfCompilationTest() {
    NeverPartOfCompilationTestNode result = new NeverPartOfCompilationTestNode();
    RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "neverPartOfCompilation", result);
    try {
        compileHelper("neverPartOfCompilation", rootNode, new Object[0]);
        Assert.fail("Expected bailout exception due to never part of compilation");
    } catch (BailoutException e) {
    // Bailout exception expected.
    }
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) BailoutException(jdk.vm.ci.code.BailoutException) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 10 with RootTestNode

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

the class ControlFlowExceptionPartialEvaluationTest method catchControlFlowExceptionFromCall.

@Test
public void catchControlFlowExceptionFromCall() {
    Assume.assumeTrue(TruffleCompilerOptions.getValue(TruffleFunctionInlining));
    CallTarget callTarget = Truffle.getRuntime().createCallTarget(new RootTestNode(new FrameDescriptor(), "throwControlFlowException", new ThrowControlFlowExceptionTestNode()));
    AbstractTestNode result = new CatchControlFlowExceptionTestNode(new CallTestNode(callTarget));
    assertPartialEvalEquals("constant42", new RootTestNode(new FrameDescriptor(), "catchControlFlowExceptionFromCall", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) CallTarget(com.oracle.truffle.api.CallTarget) 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