Search in sources :

Example 1 with BlockTestNode

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

the class SimplePartialEvaluationTest method longSequenceConstants.

@Test
public void longSequenceConstants() {
    FrameDescriptor fd = new FrameDescriptor();
    int length = 40;
    AbstractTestNode[] children = new AbstractTestNode[length];
    for (int i = 0; i < children.length; ++i) {
        children[i] = new ConstantTestNode(42);
    }
    AbstractTestNode result = new BlockTestNode(children);
    assertPartialEvalEquals("constant42", new RootTestNode(fd, "longSequenceConstants", 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) RootTestNode(org.graalvm.compiler.truffle.test.nodes.RootTestNode) Test(org.junit.Test)

Example 2 with BlockTestNode

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

the class SimplePartialEvaluationTest method sequenceConstants.

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

Example 3 with BlockTestNode

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

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

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

Aggregations

FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)6 AbstractTestNode (org.graalvm.compiler.truffle.test.nodes.AbstractTestNode)6 BlockTestNode (org.graalvm.compiler.truffle.test.nodes.BlockTestNode)6 ConstantTestNode (org.graalvm.compiler.truffle.test.nodes.ConstantTestNode)6 RootTestNode (org.graalvm.compiler.truffle.test.nodes.RootTestNode)6 Test (org.junit.Test)6 LoadLocalTestNode (org.graalvm.compiler.truffle.test.nodes.LoadLocalTestNode)4 StoreLocalTestNode (org.graalvm.compiler.truffle.test.nodes.StoreLocalTestNode)4 AddTestNode (org.graalvm.compiler.truffle.test.nodes.AddTestNode)3 LoopTestNode (org.graalvm.compiler.truffle.test.nodes.LoopTestNode)2 NestedExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.NestedExplodedLoopTestNode)2 TwoMergesExplodedLoopTestNode (org.graalvm.compiler.truffle.test.nodes.TwoMergesExplodedLoopTestNode)2