// computing gen/kill set
computeKILLSetForWrite(curr, killSet, fieldLocTuple, fldHeapPath);
- if (!fieldLoc.equals(srcLoc)) {
+
+ if (!ssjava.isSameHeightWrite(fn)) {
computeGENSetForHigherWrite(curr, genSet, fieldLocTuple, fldHeapPath);
updateDeleteSetForHigherWrite(currDeleteSet, fieldLocTuple, fldHeapPath);
} else {
fld = getArrayField(td);
}
+ NTuple<Location> lhsLocTuple = new NTuple<Location>();
+ lhsLocTuple.addAll(deriveLocationTuple(md, lhs));
+ mapDescriptorToLocationPath.put(lhs, lhsLocTuple);
+
NTuple<Location> fieldLocTuple = new NTuple<Location>();
- fieldLocTuple.addAll(deriveLocationTuple(md, lhs));
+ fieldLocTuple.addAll(lhsLocTuple);
+
if (fn.kind() == FKind.FlatSetFieldNode) {
fieldLocTuple.add((Location) fld.getType().getExtension());
}
import IR.TypeDescriptor;
import IR.TypeExtension;
import IR.VarDescriptor;
+import IR.Flat.FlatNode;
import IR.Tree.ArrayAccessNode;
import IR.Tree.AssignmentNode;
import IR.Tree.BlockExpressionNode;
}
// }
-// System.out.println("dstLocation=" + destLocation);
-// System.out.println("rhsLocation=" + rhsLocation);
-// System.out.println("srcLocation=" + srcLocation);
-// System.out.println("constraint=" + constraint);
+ // System.out.println("dstLocation=" + destLocation);
+ // System.out.println("rhsLocation=" + rhsLocation);
+ // System.out.println("srcLocation=" + srcLocation);
+ // System.out.println("constraint=" + constraint);
if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) {
+ " at " + cd.getSourceFileName() + "::" + an.getNumLine());
}
+ if (srcLocation.equals(destLocation)) {
+ // keep it for definitely written analysis
+ Set<FlatNode> flatNodeSet = ssjava.getBuildFlat().getFlatNodeSet(an);
+ for (Iterator iterator = flatNodeSet.iterator(); iterator.hasNext();) {
+ FlatNode fn = (FlatNode) iterator.next();
+ ssjava.addSameHeightWriteFlatNode(fn);
+ }
+
+ }
+
} else {
destLocation =
rhsLocation =
}
+ if (srcLocation.equals(destLocation)) {
+ // keep it for definitely written analysis
+ Set<FlatNode> flatNodeSet = ssjava.getBuildFlat().getFlatNodeSet(an);
+ for (Iterator iterator = flatNodeSet.iterator(); iterator.hasNext();) {
+ FlatNode fn = (FlatNode) iterator.next();
+ ssjava.addSameHeightWriteFlatNode(fn);
+ }
+ }
+
}
return destLocation;
// keep the field ownership from the linear type checking
Hashtable<MethodDescriptor, Set<FieldDescriptor>> mapMethodToOwnedFieldSet;
+ Set<FlatNode> sameHeightWriteFlatNodeSet;
+
CallGraph callgraph;
LinearTypeCheck checker;
this.bf = bf;
this.trustWorthyMDSet = new HashSet<MethodDescriptor>();
this.mapMethodToOwnedFieldSet = new Hashtable<MethodDescriptor, Set<FieldDescriptor>>();
+ this.sameHeightWriteFlatNodeSet = new HashSet<FlatNode>();
}
public void doCheck() {
this.ssjavaLoopEntrance = ssjavaLoopEntrance;
}
+ public void addSameHeightWriteFlatNode(FlatNode fn) {
+ this.sameHeightWriteFlatNodeSet.add(fn);
+ }
+
+ public boolean isSameHeightWrite(FlatNode fn) {
+ return this.sameHeightWriteFlatNodeSet.contains(fn);
+ }
+
}
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
fsfn.setNumLine(en.getNumLine());
+ addMapNode2FlatNodeSet(an,fsfn);
last.addNext(fsfn);
last=fsfn;
if (pre) {
last.addNext(fon2);
last=fon2;
}
+ addMapNode2FlatNodeSet(an,last);
return new NodePair(first, last);
} else if (an.getDest().kind()==Kind.NameNode) {
//We could be assigning a field or variable
FlatSetFieldNode fsfn=new FlatSetFieldNode(dst_tmp, fan.getField(), src_tmp);
fsfn.setNumLine(en.getNumLine());
+ addMapNode2FlatNodeSet(an,fsfn);
last.addNext(fsfn);
last=fsfn;
if (pre) {
fsfn=new FlatSetFieldNode(getTempforVar(nn.getVar()), nn.getField(), src_tmp);
fsfn.setNumLine(nn.getNumLine());
}
+ addMapNode2FlatNodeSet(an,fsfn);
if (first==null) {
first=fsfn;
} else {
FlatOpNode fon=new FlatOpNode(getTempforVar(nn.getVar()), src_tmp, null, new Operation(Operation.ASSIGN));
fon.setNumLine(an.getNumLine());
+ addMapNode2FlatNodeSet(an,fon);
last.addNext(fon);
last=fon;