comparison graal/com.oracle.truffle.api.codegen.test/src/com/oracle/truffle/api/codegen/test/GuardsTest.java @ 9287:8e3a1635cc9e

Implemented @NodeChild(executeWith={...}).
author Christian Humer <christian.humer@gmail.com>
date Wed, 24 Apr 2013 21:50:03 +0200
parents e27f125147d6
children 0a8bf24d660a
comparison
equal deleted inserted replaced
9286:39f08ef7b5d8 9287:8e3a1635cc9e
38 38
39 private static final Object NULL = new Object(); 39 private static final Object NULL = new Object();
40 40
41 @Test 41 @Test
42 public void testGuardInvocations() { 42 public void testGuardInvocations() {
43 TestRootNode<InvocationGuard> root = create(InvocationGuardFactory.getInstance()); 43 TestRootNode<InvocationGuard> root = createRoot(InvocationGuardFactory.getInstance());
44 44
45 assertEquals(Integer.MAX_VALUE, executeWith(root, Integer.MAX_VALUE - 1, 1)); 45 assertEquals(Integer.MAX_VALUE, executeWith(root, Integer.MAX_VALUE - 1, 1));
46 assertEquals(1, InvocationGuard.specializedInvocations); 46 assertEquals(1, InvocationGuard.specializedInvocations);
47 assertEquals(0, InvocationGuard.genericInvocations); 47 assertEquals(0, InvocationGuard.genericInvocations);
48 48
74 } 74 }
75 } 75 }
76 76
77 @Test 77 @Test
78 public void testGuardGlobal() { 78 public void testGuardGlobal() {
79 TestRootNode<GlobalFlagGuard> root = create(GlobalFlagGuardFactory.getInstance()); 79 TestRootNode<GlobalFlagGuard> root = createRoot(GlobalFlagGuardFactory.getInstance());
80 80
81 assertEquals(42, executeWith(root, NULL)); 81 assertEquals(42, executeWith(root, NULL));
82 82
83 GlobalFlagGuard.globalFlag = true; 83 GlobalFlagGuard.globalFlag = true;
84 assertEquals(41, executeWith(root, NULL)); 84 assertEquals(41, executeWith(root, NULL));