use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException 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) {
}
}
use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException 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.dsl.UnsupportedSpecializationException 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) {
}
}
use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.
the class IntrospectionTest method testReflection1.
@Test
public void testReflection1() {
Introspection1Node node = Introspection1NodeGen.create();
SpecializationInfo specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
try {
assertEquals(0, specialization.getCachedData(0));
fail();
} catch (IllegalArgumentException e) {
}
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
try {
node.execute("");
fail();
} catch (UnsupportedSpecializationException e) {
}
node.execute(1);
specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertTrue(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(1, specialization.getInstances());
assertEquals(1, specialization.getCachedData(0).get(0));
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
node.execute(1);
specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertTrue(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(1, specialization.getInstances());
assertEquals(1, specialization.getCachedData(0).get(0));
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
node.execute(2);
specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertTrue(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(2, specialization.getInstances());
assertEquals(2, specialization.getCachedData(0).get(0));
assertEquals(1, specialization.getCachedData(1).get(0));
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
node.execute(3);
specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertTrue(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(3, specialization.getInstances());
assertEquals(3, specialization.getCachedData(0).get(0));
assertEquals(2, specialization.getCachedData(1).get(0));
assertEquals(1, specialization.getCachedData(2).get(0));
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertFalse(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
node.execute(4);
specialization = Introspection.getSpecialization(node, "doInt");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(0));
assertEquals("doInt", specialization.getMethodName());
assertFalse(specialization.isActive());
assertTrue(specialization.isExcluded());
assertEquals(0, specialization.getInstances());
specialization = Introspection.getSpecialization(node, "doGeneric");
assertSpecializationEquals(specialization, Introspection.getSpecializations(node).get(1));
assertEquals("doGeneric", specialization.getMethodName());
assertTrue(specialization.isActive());
assertFalse(specialization.isExcluded());
assertEquals(1, specialization.getInstances());
assertEquals(0, specialization.getCachedData(0).size());
}
use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.
the class LimitTest method testDefaultLimit3.
@Test
public void testDefaultLimit3() {
CallTarget root = TestHelper.createCallTarget(DefaultLimit3TestFactory.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