use of com.oracle.truffle.api.CallTarget in project sulong by graalvm.
the class NFIAPITest method loadLibrary.
private static TruffleObject loadLibrary(String lib, String filename, String mimetype) {
File file = new File(TEST_DIR.toFile(), lib + "/" + filename);
String loadLib = "load '" + file.getAbsolutePath() + "'";
Source source = Source.newBuilder(loadLib).name("loadLibrary").mimeType(mimetype).build();
CallTarget target = runWithPolyglot.getTruffleTestEnv().parse(source);
return (TruffleObject) target.call();
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testStackTraceDoesNotShowOSR.
/*
* OSR stack frames should not show up.
*/
@Theory
public void testStackTraceDoesNotShowOSR(OSRLoopFactory factory) {
TestRootNode rootNode = new TestRootNode(factory, new TestOSRStackTrace());
CallTarget target = runtime.createCallTarget(rootNode);
target.call(1);
rootNode.forceOSR();
assertCompiled(rootNode.getOSRTarget());
target.call(1);
assertCompiled(rootNode.getOSRTarget());
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testOSRSingleInvocation.
/*
* Test that we achieve compilation on the first execution with a loop invoked
*/
@Theory
public void testOSRSingleInvocation(OSRLoopFactory factory) {
TestRootNode rootNode = new TestRootNode(factory, new TestRepeatingNode());
CallTarget target = runtime.createCallTarget(rootNode);
target.call(OSR_THRESHOLD + 1);
assertCompiled(rootNode.getOSRTarget());
target.call(2);
assertCompiled(rootNode.getOSRTarget());
Assert.assertTrue(rootNode.wasRepeatingCalledCompiled());
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testTwoLoopsParentChild1.
/*
* Test that two loops in a parent child relationship are propagating loop counts.
*/
@Theory
public void testTwoLoopsParentChild1(OSRLoopFactory factory) {
ChildLoopRepeatingNode childLoop = new ChildLoopRepeatingNode(factory, new TestRepeatingNode(), loop -> {
assertNotCompiled(loop.getOSRTarget());
return null;
});
TestRootNode rootNode = new TestRootNode(factory, childLoop);
CallTarget target = runtime.createCallTarget(rootNode);
target.call(1, OSR_THRESHOLD);
assertCompiled(rootNode.getOSRTarget());
assertNotCompiled(childLoop.getOSRTarget());
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testTwoLoopsParentChild2.
@Theory
public void testTwoLoopsParentChild2(OSRLoopFactory factory) {
ChildLoopRepeatingNode childLoop = new ChildLoopRepeatingNode(factory, new TestRepeatingNode(), loop -> {
assertCompiled(loop.getOSRTarget());
return null;
});
TestRootNode rootNode = new TestRootNode(factory, childLoop);
CallTarget target = runtime.createCallTarget(rootNode);
target.call(1, OSR_THRESHOLD + 1);
assertCompiled(rootNode.getOSRTarget());
assertCompiled(childLoop.getOSRTarget());
}
Aggregations