use of com.oracle.truffle.api.frame.FrameDescriptor 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 com.oracle.truffle.api.frame.FrameDescriptor 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]));
}
use of com.oracle.truffle.api.frame.FrameDescriptor 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 com.oracle.truffle.api.frame.FrameDescriptor 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 com.oracle.truffle.api.frame.FrameDescriptor 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 });
}
Aggregations