use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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.RootTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method allowedRecursion.
@Test
public void allowedRecursion() {
/* Recursion depth just below the threshold that reports it as too deep recursion. */
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new RecursionTestNode(TruffleCompilerOptions.getValue(PEGraphDecoder.Options.InliningDepthError) - 5);
assertPartialEvalEquals("constant42", new RootTestNode(fd, "allowedRecursion", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode 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.RootTestNode 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.RootTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method loopExplosionPhi.
@Test
public void loopExplosionPhi() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new LoopExplosionPhiNode();
RootNode rootNode = new RootTestNode(fd, "loopExplosionPhi", result);
OptimizedCallTarget compilable = compileHelper("loopExplosionPhi", rootNode, new Object[0]);
Assert.assertEquals(1, compilable.call(new Object[0]));
}
Aggregations