X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Repair%2FRepairCompiler%2FMCC%2FIR%2FConcreteInterferes.java;h=ddc2e0d465df61fa70406d070a091b2ef50f4dde;hb=d080c822cf26b5a8d922966fa123466bc49831ba;hp=af193f7ec4dc7df0ab1d396633a7ef8249ff7e5f;hpb=f4d787b23a126c58eec51c860f2b3d3bf8de7569;p=repair.git diff --git a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java index af193f7..ddc2e0d 100755 --- a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java +++ b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java @@ -1,5 +1,6 @@ package MCC.IR; import java.util.*; +import MCC.Compiler; public class ConcreteInterferes { Termination termination; @@ -8,31 +9,229 @@ public class ConcreteInterferes { this.termination=t; } + /** Returns true if the data structure updates performed by mun + * may increase (or decrease if satisfy=false) the scope of the + * model definition rule r. */ - static public boolean interferesinclusion(UpdateNode un, Updates update, Rule r) { + public boolean interferes(MultUpdateNode mun, Rule r, boolean satisfy) { + + // A rule that adds something to a set can't be falsified by + // an update that is only performed if the set is empty + if (!initialinterferes(mun,r,satisfy)) + return false; + + for(int i=0;i0) + ((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; - if ((ep.getOp()==Opcode.GT)&&(ep.rightSize()==0)&&!negated) - return false; - if ((ep.getOp()==Opcode.LE)&&(ep.rightSize()==0)&&negated) - return false; + 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; - if ((ep.getOp()==Opcode.GE)&&(ep.rightSize()==1)&&!negated) - return false; - if ((ep.getOp()==Opcode.LT)&&(ep.rightSize()==1)&&negated) + RelationInclusion ri=(RelationInclusion)r.getInclusion(); + Expr tmpve=ep.inverted()?ri.getRightExpr():ri.getLeftExpr(); + if (!(tmpve instanceof VarExpr)) + return true; + for(int i=0;i