use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class SimplePartialEvaluationTest method synchronizedExceptionMerge.
@Test
public void synchronizedExceptionMerge() {
/*
* Multiple non-inlineable methods with exception edges called from a synchronized method
* lead to a complicated Graal graph that involves the BytecodeFrame.UNWIND_BCI. This test
* checks that partial evaluation handles that case correctly.
*/
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new SynchronizedExceptionMergeNode();
RootNode rootNode = new RootTestNode(fd, "synchronizedExceptionMerge", result);
OptimizedCallTarget compilable = compileHelper("synchronizedExceptionMerge", rootNode, new Object[0]);
Assert.assertEquals(42, compilable.call(new Object[0]));
}
use of com.oracle.truffle.api.frame.FrameDescriptor in project graal by oracle.
the class SimplePartialEvaluationTest method intrinsicVirtual.
@Test
public void intrinsicVirtual() {
/*
* The intrinsic for String.equals() is inlined late during Truffle partial evaluation,
* because we call equals() on a value that has the static type Object, but during partial
* evaluation the more precise type String is known.
*/
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new ObjectEqualsNode("abc", "abf");
RootNode rootNode = new RootTestNode(fd, "intrinsicVirtual", result);
OptimizedCallTarget compilable = compileHelper("intrinsicVirtual", rootNode, new Object[0]);
Assert.assertEquals(42, compilable.call(new Object[0]));
}
use of com.oracle.truffle.api.frame.FrameDescriptor 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 com.oracle.truffle.api.frame.FrameDescriptor 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 com.oracle.truffle.api.frame.FrameDescriptor 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));
}
Aggregations