# HG changeset patch # User Christian Humer # Date 1408815061 -7200 # Node ID 8eca9a00aabadc685e0882c76b59313daed0a8a4 # Parent a85d43d86ea148ef9a98ead60c6deb86857c6e42 Truffle-DSL: Fixed guard matching for operations that use short circuits without boolean in the type system. diff -r a85d43d86ea1 -r 8eca9a00aaba graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ShortCircuitTest.java --- 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); diff -r a85d43d86ea1 -r 8eca9a00aaba graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java Sat Aug 23 16:55:56 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java Sat Aug 23 19:31:01 2014 +0200 @@ -79,7 +79,9 @@ for (TypeMirror typeMirror : typeMirrors) { typeIds.add(ElementUtils.getUniqueIdentifier(typeMirror)); } - typeIds.retainAll(getTypeSystem().getTypeIdentifiers()); + if (parameter.getSpecification().isSignature()) { + typeIds.retainAll(getTypeSystem().getTypeIdentifiers()); + } return new ParameterSpec(parameter.getSpecification(), typeMirrors, typeIds); }