Search in sources :

Example 6 with UnsupportedSpecializationException

use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.

the class LimitTest method testLocalLimit.

@Test
public void testLocalLimit() {
    CallTarget root = TestHelper.createCallTarget(LocalLimitTestFactory.getInstance());
    assertEquals(42, root.call(42));
    assertEquals(43, root.call(43));
    try {
        root.call(44);
        fail();
    } catch (UnsupportedSpecializationException e) {
    }
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) UnsupportedSpecializationException(com.oracle.truffle.api.dsl.UnsupportedSpecializationException) Test(org.junit.Test)

Example 7 with UnsupportedSpecializationException

use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.

the class AssumptionsTest method testMethod.

@Test
public void testMethod() {
    CallTarget root = createCallTarget(MethodTestFactory.getInstance());
    MethodTest node = getNode(root);
    assertEquals(42, root.call(42));
    assertEquals(42, root.call(42));
    node.hiddenAssumption.invalidate();
    try {
        root.call(45);
        fail();
    } catch (UnsupportedSpecializationException e) {
    }
}
Also used : TestHelper.createCallTarget(com.oracle.truffle.api.dsl.test.TestHelper.createCallTarget) CallTarget(com.oracle.truffle.api.CallTarget) UnsupportedSpecializationException(com.oracle.truffle.api.dsl.UnsupportedSpecializationException) Test(org.junit.Test)

Example 8 with UnsupportedSpecializationException

use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.

the class LimitTest method testConstantLimit.

@Test
public void testConstantLimit() {
    CallTarget root = TestHelper.createCallTarget(ConstantLimitTestFactory.getInstance());
    assertEquals(42, root.call(42));
    assertEquals(43, root.call(43));
    try {
        root.call(44);
        fail();
    } catch (UnsupportedSpecializationException e) {
    }
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) UnsupportedSpecializationException(com.oracle.truffle.api.dsl.UnsupportedSpecializationException) Test(org.junit.Test)

Example 9 with UnsupportedSpecializationException

use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException in project graal by oracle.

the class LimitTest method testMethodLimit.

@Test
public void testMethodLimit() {
    MethodLimitTest.invocations = 0;
    CallTarget root = TestHelper.createCallTarget(MethodLimitTestFactory.getInstance());
    assertEquals(42, root.call(42));
    assertEquals(43, root.call(43));
    try {
        root.call(44);
        fail();
    } catch (UnsupportedSpecializationException e) {
    }
    Assert.assertTrue(MethodLimitTest.invocations >= 3);
}
Also used : CallTarget(com.oracle.truffle.api.CallTarget) UnsupportedSpecializationException(com.oracle.truffle.api.dsl.UnsupportedSpecializationException) Test(org.junit.Test)

Example 10 with UnsupportedSpecializationException

use of com.oracle.truffle.api.dsl.UnsupportedSpecializationException 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) {
    }
}
Also used : TestHelper.createCallTarget(com.oracle.truffle.api.dsl.test.TestHelper.createCallTarget) CallTarget(com.oracle.truffle.api.CallTarget) UnsupportedSpecializationException(com.oracle.truffle.api.dsl.UnsupportedSpecializationException) Assumption(com.oracle.truffle.api.Assumption) Test(org.junit.Test)

Aggregations

UnsupportedSpecializationException (com.oracle.truffle.api.dsl.UnsupportedSpecializationException)10 Test (org.junit.Test)10 CallTarget (com.oracle.truffle.api.CallTarget)9 TestHelper.createCallTarget (com.oracle.truffle.api.dsl.test.TestHelper.createCallTarget)5 Assumption (com.oracle.truffle.api.Assumption)1 SpecializationInfo (com.oracle.truffle.api.dsl.Introspection.SpecializationInfo)1