comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteEvaluatedTest.java @ 20984:6361fa2e3321

Truffle-DSL: further fixes for polymorphic execute signatures.
author Christian Humer <christian.humer@oracle.com>
date Wed, 15 Apr 2015 21:13:43 +0200
parents 906367e494ca
children
comparison
equal deleted inserted replaced
20983:b99da6d86cfe 20984:6361fa2e3321
285 int call() { 285 int call() {
286 return 42; 286 return 42;
287 } 287 }
288 } 288 }
289 289
290 @SuppressWarnings("unused")
291 @NodeChildren({@NodeChild(value = "a", type = ValueNode.class), @NodeChild(value = "b", type = ValueNode.class)})
292 abstract static class TestEvaluatedShortCircuit1 extends Node {
293
294 public abstract Object execute1(VirtualFrame frame, Object value);
295
296 public abstract Object execute2(VirtualFrame frame, Object value, boolean hasB);
297
298 public abstract Object execute3(VirtualFrame frame, Object value, boolean hasB, Object b);
299
300 @ShortCircuit("b")
301 public boolean needsB(Object a) {
302 return true;
303 }
304
305 @Specialization
306 int call(Object a, boolean hasB, Object b) {
307 return 42;
308 }
309 }
310
311 @SuppressWarnings("unused")
312 @NodeChildren({@NodeChild(value = "a", type = ValueNode.class), @NodeChild(value = "b", type = ValueNode.class)})
313 abstract static class TestEvaluatedShortCircuit2 extends Node {
314
315 public abstract Object execute1(VirtualFrame frame, Object value);
316
317 public abstract Object execute2(VirtualFrame frame, Object value, boolean hasB);
318
319 public abstract Object execute3(VirtualFrame frame, Object value, boolean hasB, Object b);
320
321 @ShortCircuit("b")
322 public boolean needsB(Object a) {
323 return true;
324 }
325
326 @Specialization
327 int call(int a, boolean hasB, int b) {
328 return 42;
329 }
330
331 @Specialization
332 int call(Object a, boolean hasB, Object b) {
333 return 42;
334 }
335 }
336
290 } 337 }