use of org.graalvm.compiler.truffle.test.nodes.AbstractTestNode in project graal by oracle.
the class SimplePartialEvaluationTest method intrinsicStatic.
@Test
public void intrinsicStatic() {
/*
* The intrinsic for String.equals() is inlined early during bytecode parsing, because we
* call equals() on a value that has the static type String.
*/
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode result = new StringEqualsNode("abc", "abf");
RootNode rootNode = new RootTestNode(fd, "intrinsicStatic", result);
OptimizedCallTarget compilable = compileHelper("intrinsicStatic", rootNode, new Object[0]);
Assert.assertEquals(42, compilable.call(new Object[0]));
}
use of org.graalvm.compiler.truffle.test.nodes.AbstractTestNode in project graal by oracle.
the class TruffleExceptionPartialEvaluationTest method createCallerChain.
private static RootTestNode createCallerChain(int framesAbove, int framesBelow) {
FrameDescriptor fd = new FrameDescriptor();
AbstractTestNode calleeNode = new ThrowTruffleExceptionTestNode(-1, true);
RootTestNode calleeRoot = new RootTestNode(fd, "testTruffleException", calleeNode);
for (int i = 0; i < framesAbove; i++) {
AbstractTestNode call = new CallTestNode(Truffle.getRuntime().createCallTarget(calleeRoot));
calleeRoot = new RootTestNode(fd, "testTruffleException", call);
}
AbstractTestNode callerNode = new CallTestNode(Truffle.getRuntime().createCallTarget(calleeRoot));
AbstractTestNode catchNode = new CatchTruffleExceptionTestNode(callerNode);
RootTestNode callerRoot = new RootTestNode(fd, "testTruffleException", catchNode);
for (int i = 0; i < framesBelow; i++) {
AbstractTestNode call = new CallTestNode(Truffle.getRuntime().createCallTarget(callerRoot));
callerRoot = new RootTestNode(fd, "testTruffleException", call);
}
return callerRoot;
}
use of org.graalvm.compiler.truffle.test.nodes.AbstractTestNode in project graal by oracle.
the class BailoutPartialEvaluationTest method partialEvaluationConstantBailout2.
@Test(expected = BailoutException.class)
public void partialEvaluationConstantBailout2() {
FrameDescriptor fd = new FrameDescriptor();
RootTestNode rootNode = new RootTestNode(fd, "partialEvaluationConstantBailout2", new AbstractTestNode() {
@Override
public int execute(VirtualFrame frame) {
CompilerAsserts.partialEvaluationConstant(notConstantInt);
return 0;
}
});
compileHelper("partialEvaluationConstantBailout2", rootNode, new Object[] {});
}
use of org.graalvm.compiler.truffle.test.nodes.AbstractTestNode in project graal by oracle.
the class CastExactPartialEvaluationTest method byteBufferAccess.
/**
* Tests that {@link ByteBuffer} accesses do not contain any method calls, e.g. for exceptions.
*/
@Test
public void byteBufferAccess() {
AbstractTestNode result = new BufferGetPutTestNode(newBuffer().getClass());
testCommon(result, "byteBufferAccess");
}
use of org.graalvm.compiler.truffle.test.nodes.AbstractTestNode in project graal by oracle.
the class CastExactPartialEvaluationTest method exactClassProfile.
/**
* Tests that the profile created by {@link ValueProfile#createClassProfile()} casts the
* argument to the exact profiled class.
*/
@Test
public void exactClassProfile() {
AbstractTestNode result = new ExactClassProfileTestNode();
testCommon(result, "exactClassProfile");
}
Aggregations