From: yeom Date: Thu, 19 May 2011 22:17:28 +0000 (+0000) Subject: changes. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e4c02c5713ee3547fef6c7afda3360dfc02259bd;p=IRC.git changes. --- diff --git a/Robust/src/Analysis/SSJava/CompositeLocation.java b/Robust/src/Analysis/SSJava/CompositeLocation.java index 8f396a57..7baf552d 100644 --- a/Robust/src/Analysis/SSJava/CompositeLocation.java +++ b/Robust/src/Analysis/SSJava/CompositeLocation.java @@ -74,4 +74,10 @@ public class CompositeLocation implements TypeExtension { } + public CompositeLocation clone() { + CompositeLocation clone = new CompositeLocation(); + clone.getTuple().addAll(locTuple); + return clone; + } + } diff --git a/Robust/src/Analysis/SSJava/DeltaLocation.java b/Robust/src/Analysis/SSJava/DeltaLocation.java index 13f1a6cb..d4795153 100644 --- a/Robust/src/Analysis/SSJava/DeltaLocation.java +++ b/Robust/src/Analysis/SSJava/DeltaLocation.java @@ -4,15 +4,24 @@ public class DeltaLocation extends CompositeLocation { private int numDelta; + public DeltaLocation() { + super(); + } + public DeltaLocation(CompositeLocation comp, int numDelta) { + super(); this.numDelta = numDelta; - this.locTuple = comp.getTuple(); + this.locTuple.addAll(comp.getTuple()); } public int getNumDelta() { return numDelta; } + public void setNumDelta(int d) { + numDelta = d; + } + public String toString() { String rtr = ""; @@ -36,4 +45,11 @@ public class DeltaLocation extends CompositeLocation { return rtr; } + public CompositeLocation clone() { + DeltaLocation clone = new DeltaLocation(); + clone.getTuple().addAll(locTuple); + clone.setNumDelta(numDelta); + return clone; + } + } diff --git a/Robust/src/Analysis/SSJava/FlowDownCheck.java b/Robust/src/Analysis/SSJava/FlowDownCheck.java index 3edbd818..65240aa1 100644 --- a/Robust/src/Analysis/SSJava/FlowDownCheck.java +++ b/Robust/src/Analysis/SSJava/FlowDownCheck.java @@ -799,7 +799,7 @@ public class FlowDownCheck { VarDescriptor vd = (VarDescriptor) d; // localLoc = d2loc.get(vd); // the type of var descriptor has a composite location! - loc = (CompositeLocation) vd.getType().getExtension(); + loc = ((CompositeLocation) vd.getType().getExtension()).clone(); } else if (d instanceof FieldDescriptor) { // the type of field descriptor has a location! FieldDescriptor fd = (FieldDescriptor) d; @@ -813,7 +813,6 @@ public class FlowDownCheck { loc.addLocation(fieldLoc); } } - return loc; } @@ -851,9 +850,8 @@ public class FlowDownCheck { if (!postinc) { srcLocation = new CompositeLocation(); srcLocation = checkLocationFromExpressionNode(md, nametable, an.getSrc(), srcLocation); - // System.out.println("an=" + an.printNode(0) + " an.getSrc()=" + - // an.getSrc().getClass() - // + " at " + cd.getSourceFileName() + "::" + an.getNumLine()); +// System.out.println("an=" + an.printNode(0) + " an.getSrc()=" + an.getSrc().getClass() +// + " at " + cd.getSourceFileName() + "::" + an.getNumLine()); if (!CompositeLattice.isGreaterThan(srcLocation, destLocation)) { throw new Error("The value flow from " + srcLocation + " to " + destLocation + " does not respect location hierarchy on the assignment " + an.printNode(0) + " at " @@ -1054,6 +1052,8 @@ public class FlowDownCheck { public static boolean isGreaterThan(CompositeLocation loc1, CompositeLocation loc2) { +// System.out.println("isGreaterThan= " + loc1 + " " + loc2); + int baseCompareResult = compareBaseLocationSet(loc1, loc2); if (baseCompareResult == ComparisonResult.EQUAL) { if (compareDelta(loc1, loc2) == ComparisonResult.GREATER) { @@ -1116,17 +1116,36 @@ public class FlowDownCheck { SSJavaLattice lattice1 = getLatticeByDescriptor(d1); SSJavaLattice lattice2 = getLatticeByDescriptor(d2); + // check if the spin location is appeared only at the end of the + // composite location + if (lattice1.getSpinLocSet().contains(loc1.getLocIdentifier())) { + if (i != (compLoc1.getSize() - 1)) { + throw new Error("The spin location " + loc1.getLocIdentifier() + + " cannot be appeared in the middle of composite location."); + } + } + + if (lattice2.getSpinLocSet().contains(loc2.getLocIdentifier())) { + if (i != (compLoc2.getSize() - 1)) { + throw new Error("The spin location " + loc2.getLocIdentifier() + + " cannot be appeared in the middle of composite location."); + } + } + if (!lattice1.equals(lattice2)) { throw new Error("Failed to compare two locations of " + compLoc1 + " and " + compLoc2 + " because they are not comparable."); } if (loc1.getLocIdentifier().equals(loc2.getLocIdentifier())) { + numOfTie++; // check if the current location is the spinning location - if (lattice1.getSpinLocSet().contains(loc1.getLocIdentifier())) { + // note that the spinning location only can be appeared in the last + // part of the composite location + if (numOfTie == compLoc1.getSize() + && lattice1.getSpinLocSet().contains(loc1.getLocIdentifier())) { return ComparisonResult.GREATER; } - numOfTie++; continue; } else if (lattice1.isGreaterThan(loc1.getLocIdentifier(), loc2.getLocIdentifier())) { return ComparisonResult.GREATER; diff --git a/Robust/src/Tests/ssJava/flowdown/test.java b/Robust/src/Tests/ssJava/flowdown/test.java index b0e75dad..605957b3 100644 --- a/Robust/src/Tests/ssJava/flowdown/test.java +++ b/Robust/src/Tests/ssJava/flowdown/test.java @@ -91,6 +91,7 @@ public class test{ @LATTICE("mL