diff graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ShortCircuitTest.java @ 16906:8eca9a00aaba

Truffle-DSL: Fixed guard matching for operations that use short circuits without boolean in the type system.
author Christian Humer <christian.humer@gmail.com>
date Sat, 23 Aug 2014 19:31:01 +0200
parents 64dcb92ee75a
children 08aa0372dad4
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ShortCircuitTest.java	Sat Aug 23 16:55:56 2014 +0200
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ShortCircuitTest.java	Sat Aug 23 19:31:01 2014 +0200
@@ -106,6 +106,26 @@
 
     }
 
+    @NodeChildren({@NodeChild("child0"), @NodeChild("child1")})
+    @SuppressWarnings("unused")
+    abstract static class GuardChildNode extends ValueNode {
+
+        @ShortCircuit("child1")
+        boolean needsChild1(Object a) {
+            return a.equals(new Integer(42));
+        }
+
+        static boolean guard(int a, boolean hasB, int b) {
+            return false;
+        }
+
+        @Specialization(guards = "guard")
+        int doIt(int a, boolean hasB, int b) {
+            return a + b;
+        }
+
+    }
+
     @Test
     public void testVarArgs1() {
         ArgumentNode arg0 = new ArgumentNode(0);