use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method explodeLoopUntilReturn.
@Test
public void explodeLoopUntilReturn() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new ExplodeLoopUntilReturnNode();
assertPartialEvalEquals("constant42", new RootTestNode(fd, "explodeLoopUntilReturn", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class PhiStampInferencePartialEvaluationTest method ifPhiStamp.
@Test
public void ifPhiStamp() {
/*
* The stamp of a phi should be inferred during partial evaluation so that its type
* information can be used to devirtualize method calls.
*/
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new IfPhiStampTestNode();
RootNode rootNode = new RootTestNode(fd, "ifPhiStamp", result);
RootCallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
callTarget.call(new Object[] { true });
callTarget.call(new Object[] { false });
// ensure method cannot be statically bound without receiver type info
new D().get();
assertPartialEvalNoInvokes(callTarget, new Object[] { true });
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class ReadOnlyArrayListPartialEvaluationTest method constantValue.
@Test
public void constantValue() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new ReadOnlyArrayListConstantNode(42);
assertPartialEvalEquals("constant42", new RootTestNode(fd, "constantValue", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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));
}
Aggregations