use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumptionsTest method testAssumptionInvalidateTest2.
@Test
public void testAssumptionInvalidateTest2() {
AssumptionInvalidateTest2 node = AssumptionInvalidateTest2NodeGen.create();
node.execute(0);
node.execute(1);
node.execute(2);
for (int i = 0; i < 100; i++) {
int removeIndex = i % 3;
Assumption a = node.assumptions[removeIndex];
a.invalidate();
node.execute(removeIndex);
assertNotSame(a, node.assumptions[removeIndex]);
}
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumptionsTest method testAssumptionInvalidateTest3.
@Test
public void testAssumptionInvalidateTest3() {
AssumptionInvalidateTest3 node = AssumptionInvalidateTest3NodeGen.create();
node.execute(0);
for (int i = 0; i < 100; i++) {
int removeIndex = 0;
Assumption a = node.assumptions[removeIndex];
a.invalidate();
node.execute(removeIndex);
assertNotSame(a, node.assumptions[removeIndex]);
}
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumptionsTest method testAssumptionArraysCheckUseExplodeLoop.
@Test
public void testAssumptionArraysCheckUseExplodeLoop() throws SecurityException, IllegalArgumentException, NoSuchMethodException {
AssumptionArraysAreCompilationFinalCached node = TestHelper.createNode(AssumptionArraysAreCompilationFinalCachedFactory.getInstance(), false);
Method isValidMethod = node.getClass().getDeclaredMethod("isValid_", Assumption[].class);
assertNotNull(isValidMethod.getAnnotation(ExplodeLoop.class));
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumptionsTest method testAssumptionArraysAreCompilationFinal.
@Test
public void testAssumptionArraysAreCompilationFinal() throws NoSuchFieldException, SecurityException {
AssumptionArraysAreCompilationFinal node = TestHelper.createNode(AssumptionArraysAreCompilationFinalFactory.getInstance(), false);
Field field = node.getClass().getDeclaredField("do1_assumption0_");
field.setAccessible(true);
assertEquals(Assumption[].class, field.getType());
CompilationFinal compilationFinal = field.getAnnotation(CompilationFinal.class);
assertEquals(1, compilationFinal.dimensions());
}
use of com.oracle.truffle.api.Assumption in project graal by oracle.
the class AssumptionsTest method testNodeField.
@Test
public void testNodeField() {
Assumption assumption = Truffle.getRuntime().createAssumption();
CallTarget root = createCallTarget(NodeFieldTest2Factory.getInstance(), assumption);
assertEquals(42, root.call(42));
assertEquals(42, root.call(42));
assumption.invalidate();
try {
root.call(45);
fail();
} catch (UnsupportedSpecializationException e) {
}
}
Aggregations