use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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]));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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);
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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]));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class TruffleExceptionPartialEvaluationTest method createCallerChain.
private static RootTestNode createCallerChain(int framesAbove, int framesBelow) {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode calleeNode = new ThrowTruffleExceptionTestNode(-1, true);
RootTestNode calleeRoot = new RootTestNode(fd, "testTruffleException", calleeNode);
for (int i = 0; i < framesAbove; i++) {
AbstractTestNode call = new CallTestNode(Truffle.getRuntime().createCallTarget(calleeRoot));
calleeRoot = new RootTestNode(fd, "testTruffleException", call);
}
AbstractTestNode callerNode = new CallTestNode(Truffle.getRuntime().createCallTarget(calleeRoot));
AbstractTestNode catchNode = new CatchTruffleExceptionTestNode(callerNode);
RootTestNode callerRoot = new RootTestNode(fd, "testTruffleException", catchNode);
for (int i = 0; i < framesBelow; i++) {
AbstractTestNode call = new CallTestNode(Truffle.getRuntime().createCallTarget(callerRoot));
callerRoot = new RootTestNode(fd, "testTruffleException", call);
}
return callerRoot;
}
Aggregations