Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteEvaluatedTest.java Wed Apr 15 21:35:51 2015 +0200 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteEvaluatedTest.java Wed Apr 15 21:13:43 2015 +0200 @@ -287,4 +287,51 @@ } } + @SuppressWarnings("unused") + @NodeChildren({@NodeChild(value = "a", type = ValueNode.class), @NodeChild(value = "b", type = ValueNode.class)}) + abstract static class TestEvaluatedShortCircuit1 extends Node { + + public abstract Object execute1(VirtualFrame frame, Object value); + + public abstract Object execute2(VirtualFrame frame, Object value, boolean hasB); + + public abstract Object execute3(VirtualFrame frame, Object value, boolean hasB, Object b); + + @ShortCircuit("b") + public boolean needsB(Object a) { + return true; + } + + @Specialization + int call(Object a, boolean hasB, Object b) { + return 42; + } + } + + @SuppressWarnings("unused") + @NodeChildren({@NodeChild(value = "a", type = ValueNode.class), @NodeChild(value = "b", type = ValueNode.class)}) + abstract static class TestEvaluatedShortCircuit2 extends Node { + + public abstract Object execute1(VirtualFrame frame, Object value); + + public abstract Object execute2(VirtualFrame frame, Object value, boolean hasB); + + public abstract Object execute3(VirtualFrame frame, Object value, boolean hasB, Object b); + + @ShortCircuit("b") + public boolean needsB(Object a) { + return true; + } + + @Specialization + int call(int a, boolean hasB, int b) { + return 42; + } + + @Specialization + int call(Object a, boolean hasB, Object b) { + return 42; + } + } + }