Search in sources :

Example 1 with AddTestNode

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

the class SimplePartialEvaluationTest method twoMergesLoopExplosion.

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

Example 2 with AddTestNode

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

the class SimplePartialEvaluationTest method addConstants.

@Test
public void addConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    AbstractTestNode result = new AddTestNode(new ConstantTestNode(40), new ConstantTestNode(2));
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "addConstants", 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 3 with AddTestNode

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

the class SimplePartialEvaluationTest method mixLocalAndAdd.

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

Example 4 with AddTestNode

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

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

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)7 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)7 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)7 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)7 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)7 Test (org.junit.Test)7 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)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 TwoMergesExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode)3 LoopTestNode (org.graalvm.compiler.truffle.test.nodes.LoopTestNode)2