From 557d78d01153990302d2f007b2d66edd05f5544a Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sun, 18 Jul 2004 19:20:26 +0000 Subject: [PATCH] More checkins... --- Repair/RepairCompiler/MCC/CLI.java | 18 +++++-- Repair/RepairCompiler/MCC/Compiler.java | 2 + Repair/RepairCompiler/MCC/IR/CastExpr.java | 8 +++ .../MCC/IR/ConcreteInterferes.java | 2 +- Repair/RepairCompiler/MCC/IR/DotExpr.java | 2 +- Repair/RepairCompiler/MCC/IR/Expr.java | 2 +- Repair/RepairCompiler/MCC/IR/GraphNode.java | 19 +++++++ .../RepairCompiler/MCC/IR/ImplicitSchema.java | 44 ++++++++++++--- Repair/RepairCompiler/MCC/IR/Termination.java | 53 +++++++++++++------ Repair/RepairCompiler/MCC/IR/Updates.java | 30 +++++++---- 10 files changed, 143 insertions(+), 37 deletions(-) diff --git a/Repair/RepairCompiler/MCC/CLI.java b/Repair/RepairCompiler/MCC/CLI.java index 88847f6..f1f5d87 100755 --- a/Repair/RepairCompiler/MCC/CLI.java +++ b/Repair/RepairCompiler/MCC/CLI.java @@ -1,7 +1,7 @@ package MCC; -import java.util.Vector; -import java.util.StringTokenizer; +import java.util.*; +import MCC.IR.DebugItem; /** * A generic command-line interface for 6.035 compilers. This class @@ -11,7 +11,7 @@ import java.util.StringTokenizer; * files. * * @author le01, 6.035 Staff (6.035-staff@mit.edu) - * @version $Id: CLI.java,v 1.8 2004/05/31 14:19:10 bdemsky Exp $ + * @version $Id: CLI.java,v 1.9 2004/07/18 19:19:57 bdemsky Exp $ */ public class CLI { /** @@ -98,12 +98,24 @@ public class CLI { opts = new boolean[optnames.length]; + if (args.length==0) { + System.out.println("-debugcompiler -- print out debug messages"); + System.out.println("-depth depthnum constraintnum -- generate dependency graph from constraintnum with depf of depthnum"); + System.out.println("-instrument -- generate instrumentation code"); + System.out.println("-aggressivesearch"); + System.out.println("-prunequantifiernodes"); + System.exit(-1); + } + for (int i = 0; i < args.length; i++) { if (args[i].equals("-debugcompiler")) { context = 0; debug = true; } else if (args[i].equals("-checkonly")) { Compiler.REPAIR=false; + } else if (args[i].equals("-depth")) { + Compiler.debuggraphs.add(new DebugItem(Integer.parseInt(args[i+1]),Integer.parseInt(args[i+2]))); + i+=2; } else if (args[i].equals("-debug")) { Compiler.GENERATEDEBUGHOOKS=true; } else if (args[i].equals("-instrument")) { diff --git a/Repair/RepairCompiler/MCC/Compiler.java b/Repair/RepairCompiler/MCC/Compiler.java index 59609e9..a1f8bf6 100755 --- a/Repair/RepairCompiler/MCC/Compiler.java +++ b/Repair/RepairCompiler/MCC/Compiler.java @@ -24,6 +24,8 @@ public class Compiler { public static boolean GENERATEDEBUGHOOKS=false; public static boolean GENERATEDEBUGPRINT=false; public static boolean GENERATEINSTRUMENT=false; + + public static Vector debuggraphs=new Vector(); public static void main(String[] args) { State state = null; diff --git a/Repair/RepairCompiler/MCC/IR/CastExpr.java b/Repair/RepairCompiler/MCC/IR/CastExpr.java index c182a5d..0785749 100755 --- a/Repair/RepairCompiler/MCC/IR/CastExpr.java +++ b/Repair/RepairCompiler/MCC/IR/CastExpr.java @@ -7,6 +7,14 @@ public class CastExpr extends Expr { TypeDescriptor type; Expr expr; + public boolean isValue(TypeDescriptor td) { + if (td==null) /* Don't know type */ + return false; + if (!td.isSubtypeOf(type)) /* Not subtype of us */ + return false; + return expr.isValue(td); + } + public Set freeVars() { return expr.freeVars(); } diff --git a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java index af193f7..f9e0c3a 100755 --- a/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java +++ b/Repair/RepairCompiler/MCC/IR/ConcreteInterferes.java @@ -252,7 +252,7 @@ public class ConcreteInterferes { else if ((update_e instanceof DotExpr)&&(e instanceof DotExpr)) { DotExpr de1=(DotExpr)update_e; DotExpr de2=(DotExpr)e; - if (de1.isValue()&&!firstfield) + if (de1.isValue(null)&&!firstfield) return true; /* Could have aliasing from this */ if (de1.getField()!=de2.getField()) return true; /* Different fields: not comparible */ diff --git a/Repair/RepairCompiler/MCC/IR/DotExpr.java b/Repair/RepairCompiler/MCC/IR/DotExpr.java index 9fba88f..9361d5e 100755 --- a/Repair/RepairCompiler/MCC/IR/DotExpr.java +++ b/Repair/RepairCompiler/MCC/IR/DotExpr.java @@ -340,7 +340,7 @@ public class DotExpr extends Expr { } } - public boolean isValue() { + public boolean isValue(TypeDescriptor td) { FieldDescriptor tmpfd=fd; if (tmpfd instanceof ArrayDescriptor) tmpfd=((ArrayDescriptor)tmpfd).getField(); diff --git a/Repair/RepairCompiler/MCC/IR/Expr.java b/Repair/RepairCompiler/MCC/IR/Expr.java index aef0f28..d45280d 100755 --- a/Repair/RepairCompiler/MCC/IR/Expr.java +++ b/Repair/RepairCompiler/MCC/IR/Expr.java @@ -40,7 +40,7 @@ public abstract class Expr { return null; } - public boolean isValue() { + public boolean isValue(TypeDescriptor td) { return false; } diff --git a/Repair/RepairCompiler/MCC/IR/GraphNode.java b/Repair/RepairCompiler/MCC/IR/GraphNode.java index d8d2649..601123e 100755 --- a/Repair/RepairCompiler/MCC/IR/GraphNode.java +++ b/Repair/RepairCompiler/MCC/IR/GraphNode.java @@ -113,6 +113,25 @@ public class GraphNode { } } + public static void boundedcomputeclosure(Collection nodes, Collection removed,int depth) { + Stack tovisit=new Stack(); + tovisit.addAll(nodes); + for(int i=0;i