Search in sources :

Example 6 with FrameDescriptor

use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.

the class BailoutPartialEvaluationTest method partialEvaluationConstantBailout1.

@Test(expected = BailoutException.class)
public void partialEvaluationConstantBailout1() {
    FrameDescriptor fd = new FrameDescriptor();
    RootTestNode rootNode = new RootTestNode(fd, "partialEvaluationConstantBailout1", new AbstractTestNode() {

        @Override
        public int execute(VirtualFrame frame) {
            CompilerAsserts.partialEvaluationConstant(notConstant);
            return 0;
        }
    });
    compileHelper("partialEvaluationConstantBailout1", rootNode, new Object[] {});
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) VirtualFrame(com.oracle.truffle.api.frame.VirtualFrame) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 7 with FrameDescriptor

use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.

the class BytecodeInterpreterPartialEvaluationTest method instArraySimpleIfProgram.

@Test
public void instArraySimpleIfProgram() {
    FrameDescriptor fd = new FrameDescriptor();
    FrameSlot valueSlot = fd.addFrameSlot("value", FrameSlotKind.Int);
    FrameSlot returnSlot = fd.addFrameSlot("return", FrameSlotKind.Int);
    Inst[] inst = new Inst[] { /* 0: */
    new Inst.Const(valueSlot, 1, 1), /* 1: */
    new Inst.IfZero(valueSlot, 2, 4), /* 2: */
    new Inst.Const(returnSlot, 41, 3), /* 3: */
    new Inst.Return(), /* 4: */
    new Inst.Const(returnSlot, 42, 5), /* 5: */
    new Inst.Return() };
    assertPartialEvalEqualsAndRunsCorrect(new InstArrayProgram("instArraySimpleIfProgram", inst, returnSlot, fd));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) FrameSlot(com.oracle.truffle.api.frame.FrameSlot) Test(org.junit.Test)

Example 8 with FrameDescriptor

use of com.oracle.truffle.api.frame.FrameDescriptor 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 9 with FrameDescriptor

use of com.oracle.truffle.api.frame.FrameDescriptor 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 10 with FrameDescriptor

use of com.oracle.truffle.api.frame.FrameDescriptor 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)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)72 Test (org.junit.Test)61 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)50 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)12 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)9 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)7 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)7 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)6 Assumption (com.oracle.truffle.api.Assumption)5 CallTarget (com.oracle.truffle.api.CallTarget)5 TruffleRuntime (com.oracle.truffle.api.TruffleRuntime)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 RootCallTarget (com.oracle.truffle.api.RootCallTarget)2 WeakReference (java.lang.ref.WeakReference)2 List (java.util.List)2