From f4d787b23a126c58eec51c860f2b3d3bf8de7569 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sun, 9 May 2004 00:47:18 +0000 Subject: [PATCH] 1) Added useDescriptor method to Expr's. 2) Generalized analysis to determine that an update effecting a rule won't change other bindings of the same rule... --- Repair/RepairCompiler/MCC/IR/CastExpr.java | 4 + .../MCC/IR/ConcreteInterferes.java | 147 +++++++++++++++--- .../MCC/IR/ConstraintDependence.java | 2 + Repair/RepairCompiler/MCC/IR/DotExpr.java | 10 ++ .../RepairCompiler/MCC/IR/ElementOfExpr.java | 8 + Repair/RepairCompiler/MCC/IR/Expr.java | 6 +- Repair/RepairCompiler/MCC/IR/OpExpr.java | 16 +- .../RepairCompiler/MCC/IR/RelationExpr.java | 8 + Repair/RepairCompiler/MCC/IR/SetExpr.java | 7 + Repair/RepairCompiler/MCC/IR/SizeofExpr.java | 4 + Repair/RepairCompiler/MCC/IR/Termination.java | 30 +++- Repair/RepairCompiler/MCC/IR/TupleOfExpr.java | 9 ++ Repair/RepairCompiler/MCC/IR/VarExpr.java | 7 + 13 files changed, 222 insertions(+), 36 deletions(-) diff --git a/Repair/RepairCompiler/MCC/IR/CastExpr.java b/Repair/RepairCompiler/MCC/IR/CastExpr.java index 44e085d..d36aabb 100755 --- a/Repair/RepairCompiler/MCC/IR/CastExpr.java +++ b/Repair/RepairCompiler/MCC/IR/CastExpr.java @@ -38,6 +38,10 @@ public class CastExpr extends Expr { else return ((this.type==((CastExpr)e).type)&&expr.equals(remap,((CastExpr)e).expr)); } + public Set useDescriptor(Descriptor d) { + return expr.useDescriptor(d); + } + public boolean usesDescriptor(Descriptor d) { return expr.usesDescriptor(d); } diff --git a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java index f8d82d5..af193f7 100755 --- a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java +++ b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java @@ -1,7 +1,13 @@ package MCC.IR; import java.util.*; -class ConcreteInterferes { +public class ConcreteInterferes { + Termination termination; + + public ConcreteInterferes(Termination t) { + this.termination=t; + } + static public boolean interferesinclusion(UpdateNode un, Updates update, Rule r) { Descriptor updated_des=update.getDescriptor(); @@ -148,7 +154,7 @@ class ConcreteInterferes { /** 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 interferes(MultUpdateNode mun, Rule r, boolean satisfy) { + public boolean interferes(MultUpdateNode mun, Rule r, boolean satisfy) { if (!initialinterferes(mun,r,satisfy)) /* Can't falsify a rule adding something to a set on an initial addition*/ return false; for(int i=0;i=0) + continue; + } else if (q instanceof RelationQuantifier) { + RelationDescriptor rd=((RelationQuantifier)q).getRelation(); + if (maxsize.getsize(rd)<=1&& + maxsize.getsize(rd)>=0) + continue; + } + return false; + } + return true; + } } diff --git a/Repair/RepairCompiler/MCC/IR/TupleOfExpr.java b/Repair/RepairCompiler/MCC/IR/TupleOfExpr.java index 941b37a..eabd014 100755 --- a/Repair/RepairCompiler/MCC/IR/TupleOfExpr.java +++ b/Repair/RepairCompiler/MCC/IR/TupleOfExpr.java @@ -39,6 +39,15 @@ public class TupleOfExpr extends Expr { return left.usesDescriptor(d)||right.usesDescriptor(d); } + public Set useDescriptor(Descriptor d) { + HashSet newset=new HashSet(); + if (d==relation) + newset.add(this); + newset.addAll(left.useDescriptor(d)); + newset.addAll(right.useDescriptor(d)); + return newset; + } + public boolean equals(Map remap, Expr e) { if (e==null||!(e instanceof TupleOfExpr)) return false; diff --git a/Repair/RepairCompiler/MCC/IR/VarExpr.java b/Repair/RepairCompiler/MCC/IR/VarExpr.java index 00e8394..ddc0e8e 100755 --- a/Repair/RepairCompiler/MCC/IR/VarExpr.java +++ b/Repair/RepairCompiler/MCC/IR/VarExpr.java @@ -41,6 +41,13 @@ public class VarExpr extends Expr { return false; } + public Set useDescriptor(Descriptor d) { + HashSet newset=new HashSet(); + if (d==vd) + newset.add(this); + return newset; + } + public boolean isNonNull() { return true; } -- 2.34.1