use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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));
}
use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method constantValue.
@Test
public void constantValue() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new ConstantTestNode(42);
assertPartialEvalEquals("constant42", new RootTestNode(fd, "constantValue", result));
}
use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method neverPartOfCompilationTest.
@Test
public void neverPartOfCompilationTest() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode firstTree = new NeverPartOfCompilationTestNode(new ConstantTestNode(1), 2);
assertPartialEvalEquals("constant42", new RootTestNode(fd, "neverPartOfCompilationTest", firstTree));
AbstractTestNode secondTree = new NeverPartOfCompilationTestNode(new ConstantTestNode(1), 1);
try {
assertPartialEvalEquals("constant42", new RootTestNode(fd, "neverPartOfCompilationTest", secondTree));
Assert.fail("Expected verification error!");
} catch (SourceStackTraceBailoutException t) {
// Expected verification error occurred.
StackTraceElement[] trace = t.getStackTrace();
assertStack(trace[0], "org.graalvm.compiler.truffle.test.nodes.NeverPartOfCompilationTestNode", "execute", "NeverPartOfCompilationTestNode.java");
if (!truffleCompiler.getPartialEvaluator().getConfigForParsing().trackNodeSourcePosition() && !GraalOptions.TrackNodeSourcePosition.getValue(getInitialOptions())) {
assertStack(trace[1], "org.graalvm.compiler.truffle.test.nodes.RootTestNode", "execute", "RootTestNode.java");
} else {
// When NodeSourcePosition tracking is enabled, a smaller stack trace is produced
}
}
}
use of org.graalvm.compiler.truffle.test.nodes.ConstantTestNode 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.ConstantTestNode 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