Search in sources :

Example 46 with FrameDescriptor

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

the class SimplePartialEvaluationTest method longAddConstants.

@Test
public void longAddConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new ConstantTestNode(2);
    for (int i = 0; i < 20; ++i) {
        result = new AddTestNode(result, new ConstantTestNode(2));
    }
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "longAddConstants", 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 47 with FrameDescriptor

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

the class SimplePartialEvaluationTest method lambda.

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

Example 48 with FrameDescriptor

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

the class SimplePartialEvaluationTest method tooDeepRecursion.

@Test(expected = BailoutException.class)
public void tooDeepRecursion() {
    /* Recursion depth just above the threshold that reports it as too deep recursion. */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new RecursionTestNode(TruffleCompilerOptions.getValue(PEGraphDecoder.Options.InliningDepthError));
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "tooDeepRecursion", 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 49 with FrameDescriptor

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

the class SimplePartialEvaluationTest method inliningNullCheck2.

@Test
public void inliningNullCheck2() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new InliningNullCheckNode2();
    RootNode rootNode = new RootTestNode(fd, "inliningNullCheck2", result);
    OptimizedCallTarget compilable = compileHelper("inliningNullCheck2", rootNode, new Object[0]);
    Assert.assertEquals(42, 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) InliningNullCheckNode2(org.graalvm.compiler.truffle.test.nodes.InliningNullCheckNode2) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 50 with FrameDescriptor

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

the class SimplePartialEvaluationTest method localVariable.

@Test
public void localVariable() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new BlockTestNode(new AbstractTestNode[] { new StoreLocalTestNode("x", fd, new ConstantTestNode(42)), new LoadLocalTestNode("x", fd) });
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "localVariable", result));
}
Also used : FrameDescriptor(com.oracle.truffle.api.frame.FrameDescriptor) BlockTestNode(org.graalvm.compiler.truffle.test.nodes.BlockTestNode) AbstractTestNode(org.graalvm.compiler.truffle.test.nodes.AbstractTestNode) ConstantTestNode(org.graalvm.compiler.truffle.test.nodes.ConstantTestNode) StoreLocalTestNode(org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode) LoadLocalTestNode(org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode) 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