X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=blobdiff_plain;f=Repair%2FRepairCompiler%2FMCC%2FIR%2FTermination.java;h=48212d17b088a9938f4e1d850b5781939aaecad3;hp=bfbe8db16066c3780a67597b4554f36590471a26;hb=9918f5482edda50339844652d2a75e563af54ea9;hpb=cd8c06f13c3d628b15f745790e3eeac2891c5736 diff --git a/Repair/RepairCompiler/MCC/IR/Termination.java b/Repair/RepairCompiler/MCC/IR/Termination.java index bfbe8db..48212d1 100755 --- a/Repair/RepairCompiler/MCC/IR/Termination.java +++ b/Repair/RepairCompiler/MCC/IR/Termination.java @@ -15,6 +15,10 @@ public class Termination { Hashtable scopesatisfy; Hashtable scopefalsify; Hashtable consequence; + Hashtable abstractadd; + Hashtable abstractremove; + Hashtable conjtonodemap; + Set removedset; State state; @@ -29,11 +33,15 @@ public class Termination { consequence=new Hashtable(); updatenodes=new HashSet(); consequencenodes=new HashSet(); + abstractadd=new Hashtable(); + abstractremove=new Hashtable(); + conjtonodemap=new Hashtable(); generateconjunctionnodes(); generatescopenodes(); generaterepairnodes(); generatedatastructureupdatenodes(); + generatecompensationnodes(); generateabstractedges(); generatescopeedges(); @@ -41,16 +49,49 @@ public class Termination { HashSet superset=new HashSet(); superset.addAll(conjunctions); - superset.addAll(abstractrepair); - superset.addAll(updatenodes); - superset.addAll(scopenodes); - superset.addAll(consequencenodes); + HashSet closureset=new HashSet(); + // closureset.addAll(updatenodes); + //superset.addAll(abstractrepair); + //superset.addAll(updatenodes); + //superset.addAll(scopenodes); + //superset.addAll(consequencenodes); + GraphNode.computeclosure(superset,closureset); try { GraphNode.DOTVisitor.visit(new FileOutputStream("graph.dot"),superset); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } + for(Iterator it=updatenodes.iterator();it.hasNext();) { + GraphNode gn=(GraphNode)it.next(); + TermNode tn=(TermNode)gn.getOwner(); + MultUpdateNode mun=tn.getUpdate(); + System.out.println(gn.getTextLabel()); + System.out.println(mun.toString()); + } + GraphAnalysis ga=new GraphAnalysis(this); + removedset=ga.doAnalysis(); + if (removedset==null) { + System.out.println("Can't generate terminating repair algorithm!"); + System.exit(-1); + } + System.out.println("Removing:"); + for(Iterator it=removedset.iterator();it.hasNext();) { + GraphNode gn=(GraphNode)it.next(); + System.out.println(gn.getTextLabel()); + } + + superset=new HashSet(); + superset.addAll(conjunctions); + superset.removeAll(removedset); + GraphNode.computeclosure(superset,removedset); + try { + GraphNode.DOTVisitor.visit(new FileOutputStream("graphfinal.dot"),superset); + } catch (Exception e) { + e.printStackTrace(); + System.exit(-1); + } + } void generateconjunctionnodes() { @@ -60,9 +101,48 @@ public class Termination { DNFConstraint dnf=c.dnfconstraint; for(int j=0;j