Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SpecializationGroupingTest.java @ 12401:85dcc7f59c34
Truffle-DSL: fixed incorrect else guard connections for executeAndSpecialize.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 14 Oct 2013 15:44:18 +0200 |
parents | 2aac62d79af4 |
children | 5148aab962af |
comparison
equal
deleted
inserted
replaced
12400:28e7396dca1d | 12401:85dcc7f59c34 |
---|---|
35 import com.oracle.truffle.api.frame.*; | 35 import com.oracle.truffle.api.frame.*; |
36 import com.oracle.truffle.api.nodes.*; | 36 import com.oracle.truffle.api.nodes.*; |
37 | 37 |
38 /** | 38 /** |
39 * Tests execution counts of guards. While we do not make guarantees for guard invocation except for | 39 * Tests execution counts of guards. While we do not make guarantees for guard invocation except for |
40 * their execution order our implementation reduces the calls to guards as much as possible. | 40 * their execution order our implementation reduces the calls to guards as much as possible for the |
41 * generic case. | |
41 */ | 42 */ |
42 public class SpecializationGroupingTest { | 43 public class SpecializationGroupingTest { |
43 | 44 |
44 @Test | 45 @Test |
45 public void testGrouping() { | 46 public void testGrouping() { |
46 MockAssumption a1 = new MockAssumption(true); | 47 MockAssumption a1 = new MockAssumption(true); |
47 MockAssumption a2 = new MockAssumption(false); | 48 MockAssumption a2 = new MockAssumption(false); |
48 MockAssumption a3 = new MockAssumption(true); | 49 MockAssumption a3 = new MockAssumption(true); |
49 | 50 |
50 TestRootNode<TestGrouping> root = TestHelper.createRoot(TestGroupingFactory.getInstance(), a1, a2, a3); | 51 TestRootNode<TestGrouping> root = TestHelper.createGenericRoot(TestGroupingFactory.getInstance(), a1, a2, a3); |
51 | 52 |
52 SimpleTypes.intCast = 0; | 53 SimpleTypes.intCast = 0; |
53 SimpleTypes.intCheck = 0; | 54 SimpleTypes.intCheck = 0; |
54 TestGrouping.true1 = 0; | 55 TestGrouping.true1 = 0; |
55 TestGrouping.false1 = 0; | 56 TestGrouping.false1 = 0; |
69 Assert.assertEquals(1, a2.checked); | 70 Assert.assertEquals(1, a2.checked); |
70 Assert.assertEquals(1, a3.checked); | 71 Assert.assertEquals(1, a3.checked); |
71 | 72 |
72 Assert.assertEquals(42, TestHelper.executeWith(root, 21, 21)); | 73 Assert.assertEquals(42, TestHelper.executeWith(root, 21, 21)); |
73 Assert.assertEquals(2, TestGrouping.true1); | 74 Assert.assertEquals(2, TestGrouping.true1); |
74 Assert.assertEquals(1, TestGrouping.false1); | 75 Assert.assertEquals(2, TestGrouping.false1); |
75 Assert.assertEquals(2, TestGrouping.true2); | 76 Assert.assertEquals(2, TestGrouping.true2); |
76 Assert.assertEquals(2, TestGrouping.false2); | 77 Assert.assertEquals(2, TestGrouping.false2); |
77 Assert.assertEquals(2, TestGrouping.true3); | 78 Assert.assertEquals(2, TestGrouping.true3); |
78 | 79 |
79 Assert.assertEquals(2, a1.checked); | 80 Assert.assertEquals(2, a1.checked); |
80 Assert.assertEquals(1, a2.checked); | 81 Assert.assertEquals(2, a2.checked); |
81 Assert.assertEquals(2, a3.checked); | 82 Assert.assertEquals(2, a3.checked); |
82 Assert.assertEquals(2, SimpleTypes.intCheck); | 83 Assert.assertEquals(4, SimpleTypes.intCheck); |
83 Assert.assertEquals(2, SimpleTypes.intCast); | 84 Assert.assertEquals(4, SimpleTypes.intCast); |
84 | 85 |
85 } | 86 } |
86 | 87 |
87 @SuppressWarnings("unused") | 88 @SuppressWarnings("unused") |
88 @NodeChildren({@NodeChild, @NodeChild}) | 89 @NodeChildren({@NodeChild, @NodeChild}) |