use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class OptimizedOSRLoopNodeTest method doBefore.
@BeforeClass
public static void doBefore() {
// ensure that all classes are properly loaded
TestRootNode rootNode = new TestRootNode(DEFAULT, new TestRepeatingNode());
CallTarget target = runtime.createCallTarget(rootNode);
target.call(1);
rootNode = new TestRootNode(CONFIGURED, new TestRepeatingNode());
target = runtime.createCallTarget(rootNode);
target.call(1);
}
use of com.oracle.truffle.api.CallTarget 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.CallTarget in project graal by oracle.
the class GraalTVMCI method onLoopCount.
@Override
public void onLoopCount(Node source, int count) {
Node node = source;
Node parentNode = source != null ? source.getParent() : null;
while (node != null) {
if (node instanceof OptimizedOSRLoopNode) {
((OptimizedOSRLoopNode) node).reportChildLoopCount(count);
}
parentNode = node;
node = node.getParent();
}
if (parentNode != null && parentNode instanceof RootNode) {
CallTarget target = ((RootNode) parentNode).getCallTarget();
if (target instanceof OptimizedCallTarget) {
((OptimizedCallTarget) target).onLoopCount(count);
}
}
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class AssumptionsTest method testAssumptionArrays.
@Test
public void testAssumptionArrays() {
CallTarget root = createCallTarget(AssumptionArrayTestFactory.getInstance());
AssumptionArrayTest node = getNode(root);
Assumption a1 = Truffle.getRuntime().createAssumption();
Assumption a2 = Truffle.getRuntime().createAssumption();
node.assumptions = new Assumption[] { a1, a2 };
assertEquals("do1", root.call(42));
a2.invalidate();
assertEquals("do2", root.call(42));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class AssumptionsTest method testStaticField.
@Test
public void testStaticField() {
CallTarget root = createCallTarget(StaticFieldTestFactory.getInstance());
assertEquals(42, root.call(42));
assertEquals(42, root.call(42));
StaticFieldTest.FIELD.invalidate();
try {
root.call(45);
fail();
} catch (UnsupportedSpecializationException e) {
}
}
Aggregations