use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class CompilerAssertsTest method compilationNonConstantTest.
@Test
public void compilationNonConstantTest() {
FrameDescriptor descriptor = new FrameDescriptor();
CompilationConstantTestNode result = new CompilationConstantTestNode(new NonConstantTestNode(5));
RootTestNode rootNode = new RootTestNode(descriptor, "compilationConstant", result);
try {
compileHelper("compilationConstant", rootNode, new Object[0]);
Assert.fail("Expected bailout exception because expression is not compilation constant");
} catch (BailoutException e) {
// Bailout exception expected.
}
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class ControlFlowExceptionPartialEvaluationTest method catchControlFlowExceptionWithLoopExplosion.
@Test
public void catchControlFlowExceptionWithLoopExplosion() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new CatchControlFlowExceptionTestNode(new BlockTestNode(new ThrowControlFlowExceptionTestNode()));
assertPartialEvalEquals("constant42", new RootTestNode(fd, "catchControlFlowExceptionWithLoopExplosion", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class ControlFlowExceptionPartialEvaluationTest method catchControlFlowException.
@Test
public void catchControlFlowException() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new CatchControlFlowExceptionTestNode(new ThrowControlFlowExceptionTestNode());
assertPartialEvalEquals("constant42", new RootTestNode(fd, "catchControlFlowException", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class ControlFlowExceptionPartialEvaluationTest method catchSlowPathAndControlFlowException.
@Test
public void catchSlowPathAndControlFlowException() {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new CatchSlowPathAndControlFlowExceptionTestNode(new ThrowControlFlowExceptionTestNode());
assertPartialEvalEquals("constant42", new RootTestNode(fd, "catchSlowPathAndControlFlowException", result));
}
use of org.graalvm.compiler.truffle.test.nodes.RootTestNode in project graal by oracle.
the class AssumptionPartialEvaluationTest method constantValue.
@Test
public void constantValue() {
Assumption assumption = Truffle.getRuntime().createAssumption();
AbstractTestNode result = new ConstantWithAssumptionTestNode(assumption, 42);
RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "constantValue", result);
OptimizedCallTarget callTarget = assertPartialEvalEquals("constant42", rootNode);
Assert.assertTrue(callTarget.isValid());
assertDeepEquals(42, callTarget.call());
Assert.assertTrue(callTarget.isValid());
try {
assumption.check();
} catch (InvalidAssumptionException e) {
Assert.fail("Assumption must not have been invalidated.");
}
assumption.invalidate();
try {
assumption.check();
Assert.fail("Assumption must have been invalidated.");
} catch (InvalidAssumptionException e) {
}
Assert.assertFalse(callTarget.isValid());
assertDeepEquals(43, callTarget.call());
}
Aggregations