use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class AssumptionsTest method testMultipleAssumptionArrays.
@Test
public void testMultipleAssumptionArrays() {
CallTarget root = createCallTarget(MultipleAssumptionArraysTestFactory.getInstance());
MultipleAssumptionArraysTest node = getNode(root);
Assumption a1 = Truffle.getRuntime().createAssumption();
Assumption a2 = Truffle.getRuntime().createAssumption();
node.assumptions1 = new Assumption[] { a1 };
node.assumptions2 = new Assumption[] { 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 testField.
@Test
public void testField() {
CallTarget root = createCallTarget(FieldTestFactory.getInstance());
FieldTest node = getNode(root);
assertEquals(42, root.call(42));
assertEquals(42, root.call(42));
node.field.invalidate();
try {
root.call(45);
fail();
} catch (UnsupportedSpecializationException e) {
}
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class CachedTest method testCachesOrder2.
@Test
public void testCachesOrder2() {
CallTarget root = createCallTarget(TestCachesOrder2Factory.getInstance());
assertEquals(42, root.call(21));
assertEquals(44, root.call(22));
assertEquals(46, root.call(23));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class CachedTest method testCacheField.
@Test
public void testCacheField() {
CallTarget root = createCallTarget(TestCacheFieldFactory.getInstance());
assertEquals(3, root.call(42));
assertEquals(3, root.call(43));
}
use of com.oracle.truffle.api.CallTarget in project graal by oracle.
the class CachedTest method testBoundCache.
@Test
public void testBoundCache() {
CallTarget root = createCallTarget(BoundCacheFactory.getInstance());
assertEquals(42, root.call(42));
assertEquals(43, root.call(43));
assertEquals(44, root.call(44));
try {
root.call(45);
fail();
} catch (UnsupportedSpecializationException e) {
}
}
Aggregations