Search in sources :

Example 11 with ConstantTestNode

use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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)

Example 12 with ConstantTestNode

use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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 13 with ConstantTestNode

use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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 14 with ConstantTestNode

use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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)

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)14 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)14 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)14 Test (org.junit.Test)14 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)13 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)7 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)6 LoadLocalTestNode (org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode)4 StoreLocalTestNode (org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode)4 NestedExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode)3 TwoMergesExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode)3 LoopTestNode (org.graalvm.compiler.truffle.test.nodes.LoopTestNode)2 Assumption (com.oracle.truffle.api.Assumption)1 CallTarget (com.oracle.truffle.api.CallTarget)1 CompilerDirectives (com.oracle.truffle.api.CompilerDirectives)1 Truffle (com.oracle.truffle.api.Truffle)1 VirtualFrame (com.oracle.truffle.api.frame.VirtualFrame)1 DirectCallNode (com.oracle.truffle.api.nodes.DirectCallNode)1 LoopNode (com.oracle.truffle.api.nodes.LoopNode)1 Node (com.oracle.truffle.api.nodes.Node)1