Search in sources :

Example 51 with FrameDescriptor

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

the class SimplePartialEvaluationTest method nestedLoopExplosion.

@Test
public void nestedLoopExplosion() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new AddTestNode(new NestedExplodedLoopTestNode(5), new ConstantTestNode(17));
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "nestedLoopExplosion", 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) NestedExplodedLoopTestNode(org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Example 52 with FrameDescriptor

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

the class SimplePartialEvaluationTest method inliningNullCheck1.

@Test
public void inliningNullCheck1() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new InliningNullCheckNode1();
    RootNode rootNode = new RootTestNode(fd, "inliningNullCheck1", result);
    OptimizedCallTarget compilable = compileHelper("inliningNullCheck1", 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) InliningNullCheckNode1(org.graalvm.compiler.truffle.test.nodes.InliningNullCheckNode1) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 53 with FrameDescriptor

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

the class SimplePartialEvaluationTest method loop.

@Test
public void loop() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new BlockTestNode(new AbstractTestNode[] { new StoreLocalTestNode("x", fd, new ConstantTestNode(0)), new LoopTestNode(7, new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(6)))) });
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "loop", 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) NestedExplodedLoopTestNode(org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode) LoopTestNode(org.graalvm.compiler.truffle.test.nodes.LoopTestNode) TwoMergesExplodedLoopTestNode(org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode) 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) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Example 54 with FrameDescriptor

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

the class SimplePartialEvaluationTest method longLoop.

@Test
public void longLoop() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new BlockTestNode(new AbstractTestNode[] { new StoreLocalTestNode("x", fd, new ConstantTestNode(0)), new LoopTestNode(42, new StoreLocalTestNode("x", fd, new AddTestNode(new LoadLocalTestNode("x", fd), new ConstantTestNode(1)))) });
    RootTestNode rootNode = new RootTestNode(fd, "loop", result);
    assertPartialEvalNoInvokes(rootNode);
    assertPartialEvalEquals("constant42", rootNode);
}
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) NestedExplodedLoopTestNode(org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode) LoopTestNode(org.graalvm.compiler.truffle.test.nodes.LoopTestNode) TwoMergesExplodedLoopTestNode(org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode) 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) AddTestNode(org.graalvm.compiler.truffle.test.nodes.AddTestNode) Test(org.junit.Test)

Example 55 with FrameDescriptor

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

the class SimplePartialEvaluationTest method intrinsicStatic.

@Test
public void intrinsicStatic() {
    /*
         * The intrinsic for String.equals() is inlined early during bytecode parsing, because we
         * call equals() on a value that has the static type String.
         */
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new StringEqualsNode("abc", "abf");
    RootNode rootNode = new RootTestNode(fd, "intrinsicStatic", result);
    OptimizedCallTarget compilable = compileHelper("intrinsicStatic", 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) OptimizedCallTarget(org.graalvm.compiler.truffle.runtime.OptimizedCallTarget) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) StringEqualsNode(org.graalvm.compiler.truffle.test.nodes.StringEqualsNode) 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