Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SpecializationFallthroughTest.java @ 22325:414e82b9fc35
Release 0.9 is out, let's remove deprecated elements from the API
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Fri, 23 Oct 2015 20:23:00 +0200 |
parents | 5309cc9668e3 |
children |
comparison
equal
deleted
inserted
replaced
22324:ad67d348e361 | 22325:414e82b9fc35 |
---|---|
160 static class FallthroughTest2 extends ValueNode { | 160 static class FallthroughTest2 extends ValueNode { |
161 | 161 |
162 static int fallthrough1; | 162 static int fallthrough1; |
163 static int fallthrough2; | 163 static int fallthrough2; |
164 | 164 |
165 @Specialization(order = 1, rewriteOn = ArithmeticException.class) | 165 @Specialization(rewriteOn = ArithmeticException.class) |
166 int do1(int a) throws ArithmeticException { | 166 int do1(int a) throws ArithmeticException { |
167 if (a == 0) { | 167 if (a == 0) { |
168 fallthrough1++; | 168 fallthrough1++; |
169 throw new ArithmeticException(); | 169 throw new ArithmeticException(); |
170 } | 170 } |
171 return a; | 171 return a; |
172 } | 172 } |
173 | 173 |
174 @Specialization(order = 2, rewriteOn = ArithmeticException.class) | 174 @Specialization(rewriteOn = ArithmeticException.class) |
175 int do2(int a) throws ArithmeticException { | 175 int do2(int a) throws ArithmeticException { |
176 if (a == 1) { | 176 if (a == 1) { |
177 fallthrough2++; | 177 fallthrough2++; |
178 throw new ArithmeticException(); | 178 throw new ArithmeticException(); |
179 } | 179 } |
264 static class FallthroughTest4 extends ValueNode { | 264 static class FallthroughTest4 extends ValueNode { |
265 | 265 |
266 static int fallthrough1; | 266 static int fallthrough1; |
267 static int fallthrough2; | 267 static int fallthrough2; |
268 | 268 |
269 @Specialization(order = 1, rewriteOn = ArithmeticException.class) | 269 @Specialization(rewriteOn = ArithmeticException.class) |
270 int do1(int a) throws ArithmeticException { | 270 int do1(int a) throws ArithmeticException { |
271 if (a == 0) { | 271 if (a == 0) { |
272 fallthrough1++; | 272 fallthrough1++; |
273 throw new ArithmeticException(); | 273 throw new ArithmeticException(); |
274 } | 274 } |
275 return a; | 275 return a; |
276 } | 276 } |
277 | 277 |
278 @Specialization(order = 2, rewriteOn = ArithmeticException.class) | 278 @Specialization(rewriteOn = ArithmeticException.class) |
279 int do2(int a) throws ArithmeticException { | 279 int do2(int a) throws ArithmeticException { |
280 if (a == 1) { | 280 if (a == 1) { |
281 fallthrough2++; | 281 fallthrough2++; |
282 throw new ArithmeticException(); | 282 throw new ArithmeticException(); |
283 } | 283 } |