From: bdemsky Date: Fri, 30 Sep 2005 06:18:48 +0000 (+0000) Subject: Small changes to allow: X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=commitdiff_plain;h=494b62b8ddfc3c3a7282aab4ad96d0e10fb1d1bc Small changes to allow: empty structure definitions better debugging support --- diff --git a/Repair/RepairCompiler/MCC/CLI.java b/Repair/RepairCompiler/MCC/CLI.java index bd64dd3..afd51e6 100755 --- a/Repair/RepairCompiler/MCC/CLI.java +++ b/Repair/RepairCompiler/MCC/CLI.java @@ -11,7 +11,7 @@ import MCC.IR.DebugItem; * files. * * @author le01, 6.035 Staff (6.035-staff@mit.edu) - * @version $Id: CLI.java,v 1.14 2005/02/20 20:31:28 bdemsky Exp $ + * @version $Id: CLI.java,v 1.15 2005/09/30 06:18:11 bdemsky Exp $ */ public class CLI { /** @@ -109,6 +109,7 @@ public class CLI { System.out.println("-time"); System.out.println("-omitcomp"); System.out.println("-mergenodes"); + System.out.println("-debuggraph"); System.exit(-1); } @@ -120,6 +121,8 @@ public class CLI { Compiler.REPAIR=false; } else if (args[i].equals("-omitcomp")) { Compiler.OMITCOMP=true; + } else if (args[i].equals("-debuggraph")) { + Compiler.DEBUGGRAPH=true; } else if (args[i].equals("-mergenodes")) { Compiler.MERGENODES=true; } else if (args[i].equals("-depth")) { diff --git a/Repair/RepairCompiler/MCC/Compiler.java b/Repair/RepairCompiler/MCC/Compiler.java index 6fad508..213abdd 100755 --- a/Repair/RepairCompiler/MCC/Compiler.java +++ b/Repair/RepairCompiler/MCC/Compiler.java @@ -28,6 +28,7 @@ public class Compiler { public static boolean OMITCOMP=false; public static boolean MERGENODES=false; public static boolean TIME=false; + public static boolean DEBUGGRAPH=false; public static Vector debuggraphs=new Vector(); @@ -80,13 +81,8 @@ public class Compiler { nodes.addAll(state.rulenodes.values()); FileOutputStream dotfile; - dotfile = new FileOutputStream(cli.infile + ".dependencies.edgelabels.dot"); - GraphNode.useEdgeLabels = true; - GraphNode.DOTVisitor.visit(dotfile, nodes); - dotfile.close(); dotfile = new FileOutputStream(cli.infile + ".dependencies.dot"); - GraphNode.useEdgeLabels = false; GraphNode.DOTVisitor.visit(dotfile, nodes); dotfile.close(); } catch (Exception e) { diff --git a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java index 2e657ef..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; @@ -13,10 +14,10 @@ public class ConcreteInterferes { * model definition 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)) + if (!initialinterferes(mun,r,satisfy)) return false; for(int i=0;i0) @@ -486,7 +498,7 @@ public class ConcreteInterferes { for (int j=0;j " + node2.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];"); } } @@ -318,7 +317,7 @@ public class GraphNode { } - /** This function returns the set of nodes involved in cycles. + /** This function returns the set of nodes involved in cycles. * It only considers cycles containing nodes in the set 'nodes'. */ public static Set findcycles(Collection nodes) { @@ -383,7 +382,7 @@ public class GraphNode { } /** - * DFS encapsulates the depth first search algorithm + * DFS encapsulates the depth first search algorithm */ public static class DFS { @@ -394,7 +393,7 @@ public class GraphNode { HashMap sccmap; HashMap sccmaprev; - private DFS(Collection nodes) { + private DFS(Collection nodes) { this.nodes = nodes; } /** Calculates the strong connected components for the graph composed @@ -442,29 +441,29 @@ public class GraphNode { if (nodes == null) { throw new NullPointerException(); } - + DFS dfs = new DFS(nodes); return dfs.go(); } - private boolean go() { + private boolean go() { Iterator i; time = 0; boolean acyclic=true; i = nodes.iterator(); while (i.hasNext()) { GraphNode gn = (GraphNode) i.next(); - gn.reset(); - } + gn.reset(); + } i = nodes.iterator(); while (i.hasNext()) { GraphNode gn = (GraphNode) i.next(); - assert gn.getStatus() != PROCESSING; + assert gn.getStatus() != PROCESSING; if (gn.getStatus() == UNVISITED) { if (!dfs(gn)) acyclic=false; - } + } } return acyclic; } diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index cc07b7e..cf2b98d 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -57,7 +57,6 @@ public class RepairGenerator { } } - private void name_updates() { int count=0; for(Iterator it=termination.updatenodes.iterator();it.hasNext();) { diff --git a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java index 108a883..af4aa96 100755 --- a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java +++ b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java @@ -1099,7 +1099,7 @@ public class SemanticChecker { dCurrentType = type; // parse the labels and fields - if (!parse_labelsandfields(pn.getChild("lf"))) { + if (pn.getChild("lf")!=null && !parse_labelsandfields(pn.getChild("lf"))) { ok = false; } diff --git a/Repair/RepairCompiler/MCC/IR/Termination.java b/Repair/RepairCompiler/MCC/IR/Termination.java index 0a0859c..046e060 100755 --- a/Repair/RepairCompiler/MCC/IR/Termination.java +++ b/Repair/RepairCompiler/MCC/IR/Termination.java @@ -73,20 +73,20 @@ public class Termination { generateconjunctionnodes(); constraintdependence=new ConstraintDependence(state,this); - debugmsg("Generating scope nodes"); + debugmsg("*****Generating scope nodes*****"); generatescopenodes(); - debugmsg("Generating repair nodes"); + debugmsg("*****Generating repair nodes*****"); generaterepairnodes(); - debugmsg("Generating data structure nodes"); + debugmsg("*****Generating data structure nodes*****"); generatedatastructureupdatenodes(); - debugmsg("Generating compensation nodes"); + debugmsg("*****Generating compensation nodes*****"); if (!Compiler.OMITCOMP) generatecompensationnodes(); - debugmsg("Generating abstract edges"); + debugmsg("*****Generating abstract edges*****"); generateabstractedges(); - debugmsg("Generating scope edges"); + debugmsg("*****Generating scope edges*****"); generatescopeedges(); - debugmsg("Generating update edges"); + debugmsg("*****Generating update edges*****"); generateupdateedges(); @@ -243,22 +243,22 @@ public class Termination { TupleOfExpr toe=(TupleOfExpr)e; if (negated) { GraphNode agn=(GraphNode)abstractremove.get(toe.relation); - GraphNode.Edge edge=new GraphNode.Edge("requires",agn); + GraphNode.Edge edge=new GraphNode.Edge("requirestupleremove",agn); gn.addEdge(edge); } else { GraphNode agn=(GraphNode)abstractadd.get(toe.relation); - GraphNode.Edge edge=new GraphNode.Edge("requires",agn); + GraphNode.Edge edge=new GraphNode.Edge("requirestupleadd",agn); gn.addEdge(edge); } } else if (e instanceof ElementOfExpr) { ElementOfExpr eoe=(ElementOfExpr)e; if (negated) { GraphNode agn=(GraphNode)abstractremove.get(eoe.set); - GraphNode.Edge edge=new GraphNode.Edge("requires",agn); + GraphNode.Edge edge=new GraphNode.Edge("requireselementremove",agn); gn.addEdge(edge); } else { GraphNode agn=(GraphNode)abstractadd.get(eoe.set); - GraphNode.Edge edge=new GraphNode.Edge("requires",agn); + GraphNode.Edge edge=new GraphNode.Edge("requireselementadd",agn); gn.addEdge(edge); } } else throw new Error("Unrecognized Abstract Update"); @@ -268,14 +268,20 @@ public class Termination { /* Cycle through the rules to look for possible conflicts */ for(int i=0;i"+((GraphNode)scopesatisfy.get(r)).getLabel()); + } if (concreteinterferes.interferes(mun,r,true)) { GraphNode scopenode=(GraphNode)scopesatisfy.get(r); - GraphNode.Edge e=new GraphNode.Edge("interferes",scopenode); + GraphNode.Edge e=new GraphNode.Edge("satisfyscopeinterferes",scopenode); gn.addEdge(e); } + if (Compiler.DEBUGGRAPH) { + System.out.println(gn.getLabel()+"--->"+((GraphNode)scopefalsify.get(r)).getLabel()); + } if (concreteinterferes.interferes(mun,r,false)) { GraphNode scopenode=(GraphNode)scopefalsify.get(r); - GraphNode.Edge e=new GraphNode.Edge("interferes",scopenode); + GraphNode.Edge e=new GraphNode.Edge("falsifyscopeinterferes",scopenode); gn.addEdge(e); } } @@ -298,7 +304,7 @@ public class Termination { if (abstractinterferes.checkrelationconstraint(ar, cons)) continue; if (AbstractInterferes.interferesquantifier(ar,cons)) { - GraphNode.Edge e=new GraphNode.Edge("interferes",gn2); + GraphNode.Edge e=new GraphNode.Edge("interferesquantifier",gn2); gn.addEdge(e); } else { for(int i=0;i