Update to analysis.
authorbdemsky <bdemsky>
Wed, 21 Jul 2004 05:00:27 +0000 (05:00 +0000)
committerbdemsky <bdemsky>
Wed, 21 Jul 2004 05:00:27 +0000 (05:00 +0000)
Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java

index 4f6c333b01ea850589294aa9f5a6a55ea1d1a0d6..87697421636e2be976a93e53323292d7ad8d3f8f 100755 (executable)
@@ -344,12 +344,12 @@ public class ConcreteInterferes {
        return null;
     }
     
        return null;
     }
     
-    
     /** This function checks to see if an update is only performed if
     /** This function checks to see if an update is only performed if
-     * a given set is empty, and the algorithm is computing whether
-     * the update may falsify a rule that adds something to the set */
+     * a given set (or image set produced by a relation) is empty, and
+     * the algorithm is computing whether the update may falsify a
+     * rule that adds something to the set */
 
 
-    static private boolean initialinterferes(MultUpdateNode mun, Rule r, boolean satisfy) {
+    private boolean initialinterferes(MultUpdateNode mun, Rule r, boolean satisfy) {
        AbstractRepair ar=mun.getRepair();
        if ((!satisfy)&&(ar!=null)&&(ar.getType()==AbstractRepair.ADDTOSET)) {
            if (!r.getInclusion().getTargetDescriptors().contains(ar.getDescriptor()))
        AbstractRepair ar=mun.getRepair();
        if ((!satisfy)&&(ar!=null)&&(ar.getType()==AbstractRepair.ADDTOSET)) {
            if (!r.getInclusion().getTargetDescriptors().contains(ar.getDescriptor()))
@@ -368,7 +368,42 @@ public class ConcreteInterferes {
                ((op==Opcode.GT)&&(ep.rightSize()==0))|| //(>0)
                ((op==Opcode.GE)&&(ep.rightSize()==1))) //(>=1)
                return false;
                ((op==Opcode.GT)&&(ep.rightSize()==0))|| //(>0)
                ((op==Opcode.GE)&&(ep.rightSize()==1))) //(>=1)
                return false;
-       }
+       } else if ((!satisfy)&&(ar!=null)&&(ar.getType()==AbstractRepair.ADDTORELATION)) {
+           /* This test is for image sets of relations. */
+           if (!r.getInclusion().getTargetDescriptors().contains(ar.getDescriptor()))
+               return true;
+           boolean negated=ar.getPredicate().isNegated();
+           Predicate p=ar.getPredicate().getPredicate();
+           if (!(p instanceof ExprPredicate))
+               return true;
+           ExprPredicate ep=(ExprPredicate)p;
+           if (ep.getType()!=ExprPredicate.SIZE)
+               return true;
+
+           Opcode op=Opcode.translateOpcode(negated,ep.getOp());
+           if (!(((op==Opcode.EQ)&&(ep.rightSize()==1))|| //(=1)
+               ((op==Opcode.NE)&&(ep.rightSize()==0))|| //(!=0)
+               ((op==Opcode.GT)&&(ep.rightSize()==0))|| //(>0)
+               ((op==Opcode.GE)&&(ep.rightSize()==1)))) //(>=1)
+               return true;
+
+           RelationInclusion ri=(RelationInclusion)r.getInclusion();
+           Expr tmpve=ep.inverted()?ri.getRightExpr():ri.getLeftExpr();
+           if (!(tmpve instanceof VarExpr))
+               return true;
+           for(int i=0;i<mun.numUpdates();i++) {
+               UpdateNode un=mun.getUpdate(i);
+               for (int j=0;j<un.numUpdates();j++) {
+                   Updates update=un.getUpdate(j);
+                   //Abstract updates don't have concrete interference1
+                   if (update.isAbstract()) 
+                       continue;
+                   if (testdisjoint(update, r, r.getGuardExpr()))
+                       return true;
+               }
+           }
+           return false;
+       }
        return true;
     }
 
        return true;
     }