Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SpecializationGroupingTest.java @ 11481:a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 30 Aug 2013 15:55:52 +0200 |
parents | b010fd3de42d |
children | 2aac62d79af4 |
comparison
equal
deleted
inserted
replaced
11480:f33beed55ddc | 11481:a317acdd5f2c |
---|---|
25 import org.junit.*; | 25 import org.junit.*; |
26 | 26 |
27 import com.oracle.truffle.api.*; | 27 import com.oracle.truffle.api.*; |
28 import com.oracle.truffle.api.dsl.*; | 28 import com.oracle.truffle.api.dsl.*; |
29 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestElseConnectionBug1Factory; | 29 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestElseConnectionBug1Factory; |
30 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestElseConnectionBug2Factory; | |
30 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestGroupingFactory; | 31 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestGroupingFactory; |
31 import com.oracle.truffle.api.dsl.test.TypeSystemTest.SimpleTypes; | 32 import com.oracle.truffle.api.dsl.test.TypeSystemTest.SimpleTypes; |
32 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; | 33 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; |
33 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; | 34 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; |
34 import com.oracle.truffle.api.frame.*; | 35 import com.oracle.truffle.api.frame.*; |
198 return 42; | 199 return 42; |
199 } | 200 } |
200 | 201 |
201 } | 202 } |
202 | 203 |
204 @Test | |
205 public void testElseConnectionBug2() { | |
206 TestHelper.assertRuns(TestElseConnectionBug2Factory.getInstance(), 42, TestHelper.array(42)); | |
207 } | |
208 | |
209 @SuppressWarnings("unused") | |
210 @NodeChild | |
211 public abstract static class TestElseConnectionBug2 extends ValueNode { | |
212 | |
213 @Specialization(order = 2, guards = "guard0") | |
214 public int doGuard0(int value) { | |
215 throw new AssertionError(); | |
216 } | |
217 | |
218 @Specialization(order = 3, guards = "guard1") | |
219 public int doGuard1(int value) { | |
220 throw new AssertionError(); | |
221 } | |
222 | |
223 @Specialization(order = 4, guards = "!guard0") | |
224 public int doUninitialized(int value) { | |
225 return value; | |
226 } | |
227 | |
228 boolean guard0(int value) { | |
229 return false; | |
230 } | |
231 | |
232 boolean guard1(int value) { | |
233 return false; | |
234 } | |
235 } | |
236 | |
203 private static class MockAssumption implements Assumption { | 237 private static class MockAssumption implements Assumption { |
204 | 238 |
205 int checked; | 239 int checked; |
206 | 240 |
207 private final boolean valid; | 241 private final boolean valid; |