use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class CompilerAssertsTest method neverPartOfCompilationTest.
@Test
public void neverPartOfCompilationTest() {
NeverPartOfCompilationTestNode result = new NeverPartOfCompilationTestNode();
RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "neverPartOfCompilation", result);
try {
compileHelper("neverPartOfCompilation", rootNode, new Object[0]);
Assert.fail("Expected bailout exception due to never part of compilation");
} catch (BailoutException e) {
// Bailout exception expected.
}
}
use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class ControlFlowExceptionPartialEvaluationTest method catchControlFlowExceptionFromCall.
@Test
public void catchControlFlowExceptionFromCall() {
Assume.assumeTrue(TruffleCompilerOptions.getValue(TruffleFunctionInlining));
CallTarget callTarget = Truffle.getRuntime().createCallTarget(new RootTestNode(new FrameDescriptor(), "throwControlFlowException", new ThrowControlFlowExceptionTestNode()));
AbstractTestNode result = new CatchControlFlowExceptionTestNode(new CallTestNode(callTarget));
assertPartialEvalEquals("constant42", new RootTestNode(new FrameDescriptor(), "catchControlFlowExceptionFromCall", result));
}
use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class AssumptionPartialEvaluationTest method assumptionBranchCutoff.
/**
* Tests whether a valid {@link Assumption} cuts off a non-executed branch.
*/
@Test
public void assumptionBranchCutoff() {
Assumption assumption = Truffle.getRuntime().createAssumption();
AssumptionCutsBranchTestNode result = new AssumptionCutsBranchTestNode(assumption);
RootTestNode rootNode = new RootTestNode(new FrameDescriptor(), "cutoffBranch", result);
OptimizedCallTarget compilable = compileHelper("cutoffBranch", rootNode, new Object[0]);
for (int i = 0; i < 100000; i++) {
Assert.assertEquals(0, compilable.call(new Object[0]));
}
Assert.assertNull(result.getChildNode());
}
use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class OptimizedOSRLoopNode method forceOSR.
/**
* Forces OSR compilation for this loop.
*/
public final void forceOSR() {
baseLoopCount = getThreshold();
RootNode rootNode = getRootNode();
VirtualFrame dummyFrame = Truffle.getRuntime().createVirtualFrame(new Object[0], rootNode != null ? rootNode.getFrameDescriptor() : new FrameDescriptor());
compileLoop(dummyFrame);
}
use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class FrameTest method testFrameDescriptorAccess1.
@Test
public void testFrameDescriptorAccess1() {
FrameDescriptorAccess1Node node = FrameDescriptorAccess1NodeGen.create();
FrameDescriptor descriptor = new FrameDescriptor();
VirtualFrame frame = Truffle.getRuntime().createVirtualFrame(null, descriptor);
Assert.assertSame(frame.getFrameDescriptor(), node.execute(frame, 2));
Assert.assertSame(frame.getFrameDescriptor(), node.execute(frame, 3));
}
Aggregations