From: bdemsky Date: Tue, 18 May 2004 04:31:35 +0000 (+0000) Subject: Bugs: X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=159df1dd5ba4d3acf7c118983d1e1709c58d0e3d;p=repair.git Bugs: 1) Sources file assumed filesystem example 2) Bug where we were generating bad code for computing cheapest repair 3) Bug where we were generating if condition for typechecks when we shouldn't be. --- diff --git a/Repair/RepairCompiler/MCC/IR/DotExpr.java b/Repair/RepairCompiler/MCC/IR/DotExpr.java index 505459f..62fbe05 100755 --- a/Repair/RepairCompiler/MCC/IR/DotExpr.java +++ b/Repair/RepairCompiler/MCC/IR/DotExpr.java @@ -250,12 +250,16 @@ public class DotExpr extends Expr { } else if (DOTYPECHECKS) { writer.outputline("bool "+typevar.getSafeSymbol()+"=assertvalidtype(" + dest.getSafeSymbol() + ", " + this.td.getId() + ");"); } - writer.outputline("if (!"+typevar.getSafeSymbol()+")"); - writer.startblock(); - writer.outputline(dest.getSafeSymbol()+"=0;"); - if (DONULL) - writer.outputline(ptr + "(" + leftd.getSafeSymbol() + " + " + offset.getSafeSymbol() + ")=0;"); - writer.endblock(); + + if (DOTYPECHECKS||DOMEMCHECKS) { + writer.outputline("if (!"+typevar.getSafeSymbol()+")"); + writer.startblock(); + writer.outputline(dest.getSafeSymbol()+"=0;"); + if (DONULL) + writer.outputline(ptr + "(" + leftd.getSafeSymbol() + " + " + offset.getSafeSymbol() + ")=0;"); + writer.endblock(); + } + writer.endblock(); } writer.endblock(); diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index 7921577..d8da176 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -767,14 +767,14 @@ public class RepairGenerator { boolean negate=dpred.isNegated(); VarDescriptor predvalue=VarDescriptor.makeNew("Predicatevalue"); p.generate(cr,predvalue); + if (k==0) + cr.outputline("int "+costvar.getSafeSymbol()+"=0;"); + if (negate) cr.outputline("if (maybe||"+predvalue.getSafeSymbol()+")"); else cr.outputline("if (maybe||!"+predvalue.getSafeSymbol()+")"); - if (k==0) - cr.outputline("int "+costvar.getSafeSymbol()+"="+cost.getCost(dpred)+";"); - else - cr.outputline(costvar.getSafeSymbol()+"+="+cost.getCost(dpred)+";"); + cr.outputline(costvar.getSafeSymbol()+"+="+cost.getCost(dpred)+";"); } if(!first) { diff --git a/Repair/RepairCompiler/MCC/IR/Sources.java b/Repair/RepairCompiler/MCC/IR/Sources.java index bde5cc9..5d11a57 100755 --- a/Repair/RepairCompiler/MCC/IR/Sources.java +++ b/Repair/RepairCompiler/MCC/IR/Sources.java @@ -13,9 +13,9 @@ public class Sources { SetDescriptor usedblock=(SetDescriptor)state.stSets.get("UsedBlock"); SetDescriptor usedinode=(SetDescriptor)state.stSets.get("UsedInode"); - if (usedblock.isSubset(sd)) + if (usedblock!=null&&usedblock.isSubset(sd)) return true; - if (usedinode.isSubset(sd)) + if (usedinode!=null&&usedinode.isSubset(sd)) return true; return false; @@ -27,9 +27,9 @@ public class Sources { SetDescriptor usedblock=(SetDescriptor)state.stSets.get("UsedBlock"); SetDescriptor usedinode=(SetDescriptor)state.stSets.get("UsedInode"); - if (usedblock.isSubset(sd)) + if (usedblock!=null&&usedblock.isSubset(sd)) return (SetDescriptor)state.stSets.get("FreeBlock"); - if (usedinode.isSubset(sd)) + if (usedinode!=null&&usedinode.isSubset(sd)) return (SetDescriptor)state.stSets.get("FreeInode"); return null;