X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=blobdiff_plain;f=Repair%2FRepairCompiler%2FMCC%2FIR%2FRelationInclusion.java;h=0615b2528c9b44b224948f8bf31c7849b0ea4b3d;hp=58e266478fec77a6d7bc0e79d33bbd3e6906267d;hb=73e005ea3b2747a4f3008c3dcdc24c4bbcef3add;hpb=69c007fa54253b3631aba3bc32d6650730bb7d0e diff --git a/Repair/RepairCompiler/MCC/IR/RelationInclusion.java b/Repair/RepairCompiler/MCC/IR/RelationInclusion.java index 58e2664..0615b25 100755 --- a/Repair/RepairCompiler/MCC/IR/RelationInclusion.java +++ b/Repair/RepairCompiler/MCC/IR/RelationInclusion.java @@ -3,7 +3,7 @@ import MCC.Compiler; import java.util.*; public class RelationInclusion extends Inclusion { - + Expr leftelementexpr, rightelementexpr; RelationDescriptor relation; @@ -33,7 +33,7 @@ public class RelationInclusion extends Inclusion { public Expr getLeftExpr() { return leftelementexpr; } - + public Expr getRightExpr() { return rightelementexpr; } @@ -73,11 +73,11 @@ public class RelationInclusion extends Inclusion { String check = "int " + typesafecheck + " = " ; if (!(relation.getDomain() instanceof ReservedSetDescriptor)) { - check += relation.getDomain().getSafeSymbol() + "_hash->contains(" + ld.getSafeSymbol() + ") && "; + check += "SimpleHashcontainskey("+relation.getDomain().getSafeSymbol() + "_hash, "+ld.getSafeSymbol() + ") && "; } if (!(relation.getRange() instanceof ReservedSetDescriptor)) { - check += relation.getRange().getSafeSymbol() + "_hash->contains(" + rd.getSafeSymbol() + ") && "; + check += "SimpleHashcontainskey("+relation.getRange().getSafeSymbol() +"_hash, "+ rd.getSafeSymbol() + ") && "; } check += "1;"; // terminate boolean expression @@ -88,19 +88,8 @@ public class RelationInclusion extends Inclusion { } String addeditem = (VarDescriptor.makeNew("addeditem")).getSafeSymbol(); - if (!Compiler.REPAIR) { - writer.outputline("int " + addeditem + ";"); - if (relation.testUsage(RelationDescriptor.IMAGE)) { - writer.outputline(addeditem + " = " + relation.getSafeSymbol() + "_hash->add((int)" + ld.getSafeSymbol() + ", (int)" + rd.getSafeSymbol() + ");"); - } - - if (relation.testUsage(RelationDescriptor.INVIMAGE)) { - writer.outputline(addeditem + " = " + relation.getSafeSymbol() + "_hashinv->add((int)" + rd.getSafeSymbol() + ", (int)" + ld.getSafeSymbol() + ");"); - } - } else { - Repair.generate_dispatch(writer, relation, ld.getSafeSymbol(), rd.getSafeSymbol()); - } - + Repair.generate_dispatch(writer, relation, ld.getSafeSymbol(), rd.getSafeSymbol()); + if (RelationInclusion.worklist) { writer.outputline("if (" + addeditem + ")"); writer.startblock(); { @@ -119,18 +108,18 @@ public class RelationInclusion extends Inclusion { public boolean typecheck(SemanticAnalyzer sa) { TypeDescriptor ld = leftelementexpr.typecheck(sa); TypeDescriptor rd = rightelementexpr.typecheck(sa); - + if (ld == null || rd == null) { return false; } boolean ok = true; - /* #ATTN#: this check makes sure that the types match up, - a runtime check needs to made that the set relationships + /* #ATTN#: this check makes sure that the types match up, + a runtime check needs to made that the set relationships are correct */ - if (ld != relation.getDomain().getType()) { + if (ld != relation.getDomain().getType()) { sa.getErrorReporter().report(null, "Type of left element '" + ld.getSymbol() + "' must match domain type '" + relation.getDomain().getType().getSymbol() + "'"); ok = false; }