import IR.Operation;
import IR.State;
import IR.TypeDescriptor;
+import IR.TypeExtension;
import IR.Flat.FKind;
import IR.Flat.FlatCall;
import IR.Flat.FlatElementNode;
if (!ssjava.getAnnotationRequireSet().isEmpty()) {
methodReadOverWriteAnalysis();
writtenAnalyis();
- // sharedLocationAnalysis();
- // checkSharedLocationResult();
+ sharedLocationAnalysis();
+ checkSharedLocationResult();
}
}
// mapping of method containing ssjava loop has the final result of
// shared location analysis
+
ClearingSummary result =
- mapMethodDescriptorToCompleteClearingSummary.get(sortedDescriptors.peekFirst());
+ mapMethodDescriptorToCompleteClearingSummary.get(methodContainingSSJavaLoop);
+
+ System.out.println("###RESULT=" + result);
Set<NTuple<Descriptor>> hpKeySet = result.keySet();
for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
Location locKey = (Location) iterator2.next();
if (!state.getFlag(locKey)) {
throw new Error(
- "Some concrete locations of the shared abstract location are not cleared at the same time.");
+ "Some concrete locations of the shared abstract location are not cleared at the same time:"
+ + state);
}
}
}
computeReadSharedDescriptorSet();
+
+ // methodDescriptorsToVisitStack.clear();
+ // methodDescriptorsToVisitStack.add(sortedDescriptors.peekFirst());
+
+ LinkedList<MethodDescriptor> descriptorListToAnalyze =
+ (LinkedList<MethodDescriptor>) sortedDescriptors.clone();
+
+ // current descriptors to visit in fixed-point interprocedural analysis,
+ // prioritized by
+ // dependency in the call graph
methodDescriptorsToVisitStack.clear();
- methodDescriptorsToVisitStack.add(sortedDescriptors.peekFirst());
+ Set<MethodDescriptor> methodDescriptorToVistSet = new HashSet<MethodDescriptor>();
+ methodDescriptorToVistSet.addAll(descriptorListToAnalyze);
+
+ while (!descriptorListToAnalyze.isEmpty()) {
+ MethodDescriptor md = descriptorListToAnalyze.removeFirst();
+ methodDescriptorsToVisitStack.add(md);
+ }
// analyze scheduled methods until there are no more to visit
while (!methodDescriptorsToVisitStack.isEmpty()) {
if (!completeSummary.equals(prevCompleteSummary)) {
+ ClearingSummary summaryFromCaller = mapMethodDescriptorToInitialClearingSummary.get(md);
+// System.out.println("# summaryFromCaller=" + summaryFromCaller);
+// System.out.println("# completeSummary=" + completeSummary);
+// System.out.println("# prev=" + prevCompleteSummary);
+// System.out.println("# changed!\n");
+
mapMethodDescriptorToCompleteClearingSummary.put(md, completeSummary);
// results for callee changed, so enqueue dependents caller for
mapMethodDescriptorToInitialClearingSummary.get(fm.getMethod());
Set<ClearingSummary> inSet = new HashSet<ClearingSummary>();
- inSet.add(summaryFromCaller);
- mergeSharedLocationAnaylsis(curr, inSet);
+ if (summaryFromCaller != null) {
+ inSet.add(summaryFromCaller);
+ mergeSharedLocationAnaylsis(curr, inSet);
+ }
}
break;
// read field
NTuple<Descriptor> srcHeapPath = mapHeapPath.get(rhs);
- // if (srcHeapPath != null) {
- // // if lhs srcHeapPath is null, it means that it is not reachable from
- // // callee's parameters. so just ignore it
- NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(srcHeapPath.getList());
+ if (srcHeapPath != null) {
+ // if lhs srcHeapPath is null, it means that it is not reachable from
+ // callee's parameters. so just ignore it
+ NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(srcHeapPath.getList());
+
+ if (fld.getType().isImmutable()) {
+ readLocation(curr, fldHeapPath, fld);
+ }else{
+ fldHeapPath.add(fld);
+ mapHeapPath.put(lhs, fldHeapPath);
+ }
+
+
+
- if (fld.getType().isImmutable()) {
- readLocation(curr, fldHeapPath, fld);
}
+
// }
}
case FKind.FlatSetFieldNode:
case FKind.FlatSetElementNode: {
- FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
- lhs = fsfn.getDst();
- fld = fsfn.getField();
+ if (fn.kind() == FKind.FlatSetFieldNode) {
+ FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
+ lhs = fsfn.getDst();
+ fld = fsfn.getField();
+ rhs = fsfn.getSrc();
+ } else {
+ FlatSetElementNode fsen = (FlatSetElementNode) fn;
+ lhs = fsen.getDst();
+ rhs = fsen.getSrc();
+ TypeDescriptor td = lhs.getType().dereference();
+ fld = getArrayField(td);
+ }
// write(field)
NTuple<Descriptor> lhsHeapPath = computePath(lhs);
NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(lhsHeapPath.getList());
if (fld.getType().isImmutable()) {
writeLocation(curr, fldHeapPath, fld);
+ fldHeapPath.add(fld);
} else {
// updates reference field case:
// 2. if there exists a tuple t in sharing summary that starts with
FlatCall fc = (FlatCall) fn;
- // find out the set of callees
- MethodDescriptor mdCallee = fc.getMethod();
- FlatMethod fmCallee = state.getMethodFlat(mdCallee);
- Set<MethodDescriptor> setPossibleCallees = new HashSet<MethodDescriptor>();
- // TypeDescriptor typeDesc = fc.getThis().getType();
- setPossibleCallees.addAll(callGraph.getMethods(mdCallee));
+ if (ssjava.isSSJavaUtil(fc.getMethod().getClassDesc())) {
+ // ssjava util case!
+ // have write effects on the first argument
+ NTuple<Descriptor> argHeapPath = computePath(fc.getArg(0));
+ // writeLocation(curr, argHeapPath, fc.getArg(0));
+ } else {
+ // find out the set of callees
+ MethodDescriptor mdCallee = fc.getMethod();
+ FlatMethod fmCallee = state.getMethodFlat(mdCallee);
+ Set<MethodDescriptor> setPossibleCallees = new HashSet<MethodDescriptor>();
+ // TypeDescriptor typeDesc = fc.getThis().getType();
+ setPossibleCallees.addAll(callGraph.getMethods(mdCallee));
- possibleCalleeCompleteSummarySetToCaller.clear();
+ possibleCalleeCompleteSummarySetToCaller.clear();
- for (Iterator iterator = setPossibleCallees.iterator(); iterator.hasNext();) {
- MethodDescriptor mdPossibleCallee = (MethodDescriptor) iterator.next();
- FlatMethod calleeFlatMethod = state.getMethodFlat(mdPossibleCallee);
- addDependent(mdPossibleCallee, // callee
- caller); // caller
+ for (Iterator iterator = setPossibleCallees.iterator(); iterator.hasNext();) {
+ MethodDescriptor mdPossibleCallee = (MethodDescriptor) iterator.next();
+ FlatMethod calleeFlatMethod = state.getMethodFlat(mdPossibleCallee);
- calleesToEnqueue.add(mdPossibleCallee);
+ addDependent(mdPossibleCallee, // callee
+ caller); // caller
- // updates possible callee's initial summary using caller's current
- // writing status
- ClearingSummary prevCalleeInitSummary =
- mapMethodDescriptorToInitialClearingSummary.get(mdPossibleCallee);
+ calleesToEnqueue.add(mdPossibleCallee);
- ClearingSummary calleeInitSummary =
- bindHeapPathOfCalleeCallerEffects(fc, calleeFlatMethod, curr);
+ // updates possible callee's initial summary using caller's current
+ // writing status
+ ClearingSummary prevCalleeInitSummary =
+ mapMethodDescriptorToInitialClearingSummary.get(mdPossibleCallee);
- // if changes, update the init summary
- // and reschedule the callee for analysis
- if (!calleeInitSummary.equals(prevCalleeInitSummary)) {
+ ClearingSummary calleeInitSummary =
+ bindHeapPathOfCalleeCallerEffects(fc, calleeFlatMethod, curr);
- if (!methodDescriptorsToVisitStack.contains(mdPossibleCallee)) {
- methodDescriptorsToVisitStack.add(mdPossibleCallee);
+ Set<ClearingSummary> inSet = new HashSet<ClearingSummary>();
+ if (prevCalleeInitSummary != null) {
+ inSet.add(prevCalleeInitSummary);
+ mergeSharedLocationAnaylsis(calleeInitSummary, inSet);
}
- mapMethodDescriptorToInitialClearingSummary.put(mdPossibleCallee, calleeInitSummary);
- }
- }
+ // if changes, update the init summary
+ // and reschedule the callee for analysis
+ if (!calleeInitSummary.equals(prevCalleeInitSummary)) {
+// System.out.println("#CALLEE INIT CHANGED=" + mdPossibleCallee);
+// System.out.println("# prev=" + prevCalleeInitSummary);
+// System.out.println("# current=" + calleeInitSummary);
+// System.out.println("#");
+
+ if (!methodDescriptorsToVisitStack.contains(mdPossibleCallee)) {
+ methodDescriptorsToVisitStack.add(mdPossibleCallee);
+ }
- // contribute callee's writing effects to the caller
- mergeSharedLocationAnaylsis(curr, possibleCalleeCompleteSummarySetToCaller);
+ mapMethodDescriptorToInitialClearingSummary.put(mdPossibleCallee, calleeInitSummary);
+ }
+
+ }
+// System.out.println("callee " + fc + " summary=" + possibleCalleeCompleteSummarySetToCaller);
+ // contribute callee's writing effects to the caller
+ mergeSharedLocationAnaylsis(curr, possibleCalleeCompleteSummarySetToCaller);
+ }
}
break;
Hashtable<Integer, TempDescriptor> mapParamIdx2ParamTempDesc =
new Hashtable<Integer, TempDescriptor>();
+ int offset = 0;
+ if (calleeFlatMethod.getMethod().isStatic()) {
+ // static method does not have implicit 'this' arg
+ offset = 1;
+ }
for (int i = 0; i < calleeFlatMethod.numParameters(); i++) {
TempDescriptor param = calleeFlatMethod.getParameter(i);
- mapParamIdx2ParamTempDesc.put(Integer.valueOf(i), param);
+ mapParamIdx2ParamTempDesc.put(Integer.valueOf(i + offset), param);
}
// binding caller's writing effects to callee's params
for (int i = 0; i < calleeFlatMethod.numParameters(); i++) {
NTuple<Descriptor> argHeapPath = mapArgIdx2CallerArgHeapPath.get(Integer.valueOf(i));
- TempDescriptor calleeParamHeapPath = mapParamIdx2ParamTempDesc.get(Integer.valueOf(i));
- // iterate over caller's writing effect set
- Set<NTuple<Descriptor>> hpKeySet = curr.keySet();
- for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
- NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
- // current element is reachable caller's arg
- // so need to bind it to the caller's side and add it to the callee's
- // init summary
- if (hpKey.startsWith(argHeapPath)) {
- NTuple<Descriptor> boundHeapPath = replace(hpKey, argHeapPath, calleeParamHeapPath);
- boundSet.put(boundHeapPath, curr.get(hpKey).clone());
- }
+ if (argHeapPath != null) {
+ // if method is static, the first argument is nulll because static
+ // method does not have implicit "THIS" arg
+ TempDescriptor calleeParamHeapPath = mapParamIdx2ParamTempDesc.get(Integer.valueOf(i));
+ // iterate over caller's writing effect set
+ Set<NTuple<Descriptor>> hpKeySet = curr.keySet();
+ for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
+ NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
+ // current element is reachable caller's arg
+ // so need to bind it to the caller's side and add it to the
+ // callee's
+ // init summary
+ if (hpKey.startsWith(argHeapPath)) {
+ NTuple<Descriptor> boundHeapPath = replace(hpKey, argHeapPath, calleeParamHeapPath);
+ boundSet.put(boundHeapPath, curr.get(hpKey).clone());
+ }
+
+ }
}
}
// contribute callee's complete summary into the caller's current summary
ClearingSummary calleeCompleteSummary =
mapMethodDescriptorToCompleteClearingSummary.get(calleeFlatMethod.getMethod());
-
if (calleeCompleteSummary != null) {
ClearingSummary boundCalleeEfffects = new ClearingSummary();
for (int i = 0; i < calleeFlatMethod.numParameters(); i++) {
+ // for (int i = 0; i < fc.numArgs(); i++) {
NTuple<Descriptor> argHeapPath = mapArgIdx2CallerArgHeapPath.get(Integer.valueOf(i));
- TempDescriptor calleeParamHeapPath = mapParamIdx2ParamTempDesc.get(Integer.valueOf(i));
- // iterate over callee's writing effect set
- Set<NTuple<Descriptor>> hpKeySet = calleeCompleteSummary.keySet();
- for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
- NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
- // current element is reachable caller's arg
- // so need to bind it to the caller's side and add it to the callee's
- // init summary
- if (hpKey.startsWith(calleeParamHeapPath)) {
+ if (argHeapPath != null) {
+ // if method is static, the first argument is nulll because static
+ // method does not have implicit "THIS" arg
+ TempDescriptor calleeParamHeapPath = mapParamIdx2ParamTempDesc.get(Integer.valueOf(i));
+
+ // iterate over callee's writing effect set
+ Set<NTuple<Descriptor>> hpKeySet = calleeCompleteSummary.keySet();
+ for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
+ NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
+ // current element is reachable caller's arg
+ // so need to bind it to the caller's side and add it to the
+ // callee's
+ // init summary
+ if (hpKey.startsWith(calleeParamHeapPath)) {
- NTuple<Descriptor> boundHeapPathForCaller = replace(hpKey, argHeapPath);
+ NTuple<Descriptor> boundHeapPathForCaller = replace(hpKey, argHeapPath);
- boundCalleeEfffects.put(boundHeapPathForCaller, calleeCompleteSummary.get(hpKey)
- .clone());
+ boundCalleeEfffects.put(boundHeapPathForCaller, calleeCompleteSummary.get(hpKey)
+ .clone());
+ }
}
+
}
+
}
possibleCalleeCompleteSummarySetToCaller.add(boundCalleeEfffects);
}
lhs = ffn.getDst();
rhs = ffn.getSrc();
fld = ffn.getField();
+ if (fld.isStatic() && fld.isFinal()) {
+ break;
+ }
} else {
FlatElementNode fen = (FlatElementNode) fn;
lhs = fen.getDst();
rhs = fen.getSrc();
TypeDescriptor td = rhs.getType().dereference();
fld = getArrayField(td);
+ if (fld.isStatic() && fld.isFinal()) {
+ break;
+ }
}
- // FlatFieldNode ffn = (FlatFieldNode) fn;
- // lhs = ffn.getDst();
- // rhs = ffn.getSrc();
- // fld = ffn.getField();
-
// read field
NTuple<Descriptor> srcHeapPath = mapHeapPath.get(rhs);
- NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(srcHeapPath.getList());
- // fldHeapPath.add(fld);
+ if (srcHeapPath != null) {
+ // if srcHeapPath is null, it means that it is not reachable from
+ // callee's parameters. so just ignore it
- if (fld.getType().isImmutable()) {
- addReadDescriptor(fldHeapPath, fld);
- }
+ NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(srcHeapPath.getList());
+ // fldHeapPath.add(fld);
- // propagate rhs's heap path to the lhs
- mapHeapPath.put(lhs, fldHeapPath);
+ if (fld.getType().isImmutable()) {
+ addReadDescriptor(fldHeapPath, fld);
+ }
+
+ // propagate rhs's heap path to the lhs
+ mapHeapPath.put(lhs, fldHeapPath);
+ }
}
break;
case FKind.FlatSetFieldNode:
case FKind.FlatSetElementNode: {
- FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
- lhs = fsfn.getDst();
- fld = fsfn.getField();
+ if (fn.kind() == FKind.FlatSetFieldNode) {
+ FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
+ lhs = fsfn.getDst();
+ fld = fsfn.getField();
+ } else {
+ FlatSetElementNode fsen = (FlatSetElementNode) fn;
+ lhs = fsen.getDst();
+ rhs = fsen.getSrc();
+ TypeDescriptor td = lhs.getType().dereference();
+ fld = getArrayField(td);
+ }
// write(field)
NTuple<Descriptor> lhsHeapPath = computePath(lhs);
private void addReadDescriptor(NTuple<Descriptor> hp, Descriptor d) {
Location loc = getLocation(d);
-
if (loc != null && ssjava.isSharedLocation(loc)) {
-
Set<Descriptor> set = mapSharedLocation2DescriptorSet.get(loc);
if (set == null) {
set = new HashSet<Descriptor>();
mapSharedLocation2DescriptorSet.put(loc, set);
}
set.add(d);
+
}
}
return (Location) ((FieldDescriptor) d).getType().getExtension();
} else {
assert d instanceof TempDescriptor;
- CompositeLocation comp = (CompositeLocation) ((TempDescriptor) d).getType().getExtension();
- if (comp == null) {
- return null;
- } else {
- return comp.get(comp.getSize() - 1);
+ TempDescriptor td = (TempDescriptor) d;
+
+ TypeExtension te = td.getType().getExtension();
+ if (te != null) {
+ if (te instanceof CompositeLocation) {
+ CompositeLocation comp = (CompositeLocation) te;
+
+ return comp.get(comp.getSize() - 1);
+ } else {
+ return (Location) te;
+ }
}
}
+ return null;
}
private void writeLocation(ClearingSummary curr, NTuple<Descriptor> hp, Descriptor d) {
+
Location loc = getLocation(d);
if (loc != null && hasReadingEffectOnSharedLocation(hp, loc, d)) {
-
// 1. add field x to the clearing set
SharedStatus state = getState(curr, hp);
state.addVar(loc, d);
}
private void mergeSharedLocationAnaylsis(ClearingSummary curr, Set<ClearingSummary> inSet) {
-
if (inSet.size() == 0) {
return;
}
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
SharedStatus inState = inTable.get(hpKey);
-
SharedStatus currState = curr.get(hpKey);
if (currState == null) {
currState = new SharedStatus();
private void checkDeclarationInMethodBody(ClassDescriptor cd, MethodDescriptor md) {
BlockNode bn = state.getMethodBody(md);
- System.out.println("\n#checkDeclarationInMethodBody=" + md);
// first, check annotations on method parameters
List<CompositeLocation> paramList = new ArrayList<CompositeLocation>();
CompositeLocation thisLoc = new CompositeLocation(new Location(md, thisLocId));
paramList.add(0, thisLoc);
- System.out.println("### ReturnLocGenerator=" + md);
- System.out.println("### md2ReturnLoc.get(md)=" + md2ReturnLoc.get(md));
+// System.out.println("### ReturnLocGenerator=" + md);
+// System.out.println("### md2ReturnLoc.get(md)=" + md2ReturnLoc.get(md));
md2ReturnLocGen.put(md, new ReturnLocGenerator(md2ReturnLoc.get(md), md, paramList, md
+ " of " + cd.getSourceFileName()));
}
- System.out.println("\n#checkLocationFromMethodInvokeNode=" + min.printNode(0)
- + " baseLocation=" + baseLocation + " constraint=" + constraint);
+// System.out.println("\n#checkLocationFromMethodInvokeNode=" + min.printNode(0)
+// + " baseLocation=" + baseLocation + " constraint=" + constraint);
if (constraint != null) {
int compareResult =
// no need to check constraints!
CompositeLocation calleeConstraint =
translateCallerLocToCalleeLoc(calleeMD, baseLocation, constraint);
- System.out.println("check method body for constraint:" + calleeMD + " calleeConstraint="
- + calleeConstraint);
+// System.out.println("check method body for constraint:" + calleeMD + " calleeConstraint="
+// + calleeConstraint);
checkMethodBody(calleeMD.getClassDesc(), calleeMD, calleeConstraint);
}
}
String errorMsg = generateErrorMessage(md.getClassDesc(), min);
- System.out.println("checkCallerArgumentLocationConstraints=" + min.printNode(0));
- System.out.println("base location=" + callerBaseLoc + " constraint=" + constraint);
+// System.out.println("checkCallerArgumentLocationConstraints=" + min.printNode(0));
+// System.out.println("base location=" + callerBaseLoc + " constraint=" + constraint);
for (int i = 0; i < calleeParamList.size(); i++) {
CompositeLocation calleeParamLoc = calleeParamList.get(i);
translate.addLocation(calleeParamLoc.get(i));
}
- System.out.println("TRANSLATED=" + translate + " from calleeParamLoc=" + calleeParamLoc);
+// System.out.println("TRANSLATED=" + translate + " from calleeParamLoc=" + calleeParamLoc);
return translate;
}
argList.add(callerArg);
}
- System.out.println("\n## computeReturnLocation=" + min.getMethod() + " argList=" + argList);
+// System.out.println("\n## computeReturnLocation=" + min.getMethod() + " argList=" + argList);
CompositeLocation ceilLoc = md2ReturnLocGen.get(min.getMethod()).computeReturnLocation(argList);
- System.out.println("## ReturnLocation=" + ceilLoc);
+// System.out.println("## ReturnLocation=" + ceilLoc);
return ceilLoc;
private void checkCalleeConstraints(MethodDescriptor md, SymbolTable nametable,
MethodInvokeNode min, CompositeLocation callerBaseLoc, CompositeLocation constraint) {
- System.out.println("checkCalleeConstraints=" + min.printNode(0));
+// System.out.println("checkCalleeConstraints=" + min.printNode(0));
MethodDescriptor calleemd = min.getMethod();
for (int i = 0; i < calleemd.numParameters(); i++) {
VarDescriptor calleevd = (VarDescriptor) calleemd.getParameter(i);
CompositeLocation calleeLoc = d2loc.get(calleevd);
- System.out.println("calleevd=" + calleevd + " loc=" + calleeLoc);
+// System.out.println("calleevd=" + calleevd + " loc=" + calleeLoc);
calleeParamList.add(calleeLoc);
}
continue CHECK;
}
- System.out.println("calleeLoc1=" + calleeLoc1);
- System.out.println("calleeLoc2=" + calleeLoc2 + "calleeParamList=" + calleeParamList);
+// System.out.println("calleeLoc1=" + calleeLoc1);
+// System.out.println("calleeLoc2=" + calleeLoc2 + "calleeParamList=" + calleeParamList);
int callerResult =
CompositeLattice.compare(callerLoc1, callerLoc2, true,
// addTypeLocation(on.getRight().getType(), rightLoc);
}
- System.out.println("\n# OP NODE=" + on.printNode(0));
- System.out.println("# left loc=" + leftLoc + " from " + on.getLeft().getClass());
- if (on.getRight() != null) {
- System.out.println("# right loc=" + rightLoc + " from " + on.getRight().getClass());
- }
+// System.out.println("\n# OP NODE=" + on.printNode(0));
+// System.out.println("# left loc=" + leftLoc + " from " + on.getLeft().getClass());
+// if (on.getRight() != null) {
+// System.out.println("# right loc=" + rightLoc + " from " + on.getRight().getClass());
+// }
Operation op = on.getOp();
inputSet.add(rightLoc);
CompositeLocation glbCompLoc =
CompositeLattice.calculateGLB(inputSet, generateErrorMessage(cd, on));
- System.out.println("# glbCompLoc=" + glbCompLoc);
+// System.out.println("# glbCompLoc=" + glbCompLoc);
return glbCompLoc;
default:
}
if (left instanceof ArrayAccessNode) {
- System.out.println("HEREE!!");
ArrayAccessNode aan = (ArrayAccessNode) left;
left = aan.getExpression();
}
loc = checkLocationFromExpressionNode(md, nametable, left, loc, constraint, false);
- System.out.println("### checkLocationFromFieldAccessNode=" + fan.printNode(0));
- System.out.println("### left=" + left.printNode(0));
+// System.out.println("### checkLocationFromFieldAccessNode=" + fan.printNode(0));
+// System.out.println("### left=" + left.printNode(0));
if (!left.getType().isPrimitive()) {
Location fieldLoc = getFieldLocation(fd);
loc.addLocation(fieldLoc);
}
- System.out.println("### field loc=" + loc);
+// System.out.println("### field loc=" + loc);
return loc;
}
private Location getFieldLocation(FieldDescriptor fd) {
- System.out.println("### getFieldLocation=" + fd);
- System.out.println("### fd.getType().getExtension()=" + fd.getType().getExtension());
+// System.out.println("### getFieldLocation=" + fd);
+// System.out.println("### fd.getType().getExtension()=" + fd.getType().getExtension());
Location fieldLoc = (Location) fd.getType().getExtension();
private CompositeLocation checkLocationFromAssignmentNode(MethodDescriptor md,
SymbolTable nametable, AssignmentNode an, CompositeLocation loc, CompositeLocation constraint) {
- System.out.println("\n# ASSIGNMENTNODE=" + an.printNode(0));
+// System.out.println("\n# ASSIGNMENTNODE=" + an.printNode(0));
ClassDescriptor cd = md.getClassDesc();
}
// }
- 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))) {
srcLocation = rhsLocation;
}
- System.out.println("srcLocation=" + srcLocation);
- System.out.println("rhsLocation=" + rhsLocation);
- System.out.println("constraint=" + constraint);
+// System.out.println("srcLocation=" + srcLocation);
+// System.out.println("rhsLocation=" + rhsLocation);
+// System.out.println("constraint=" + constraint);
if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) {
Descriptor d = state.getClassSymbolTable().get(className);
if (d == null) {
- System.out.println("state.getClassSymbolTable()=" + state.getClassSymbolTable());
+// System.out.println("state.getClassSymbolTable()=" + state.getClassSymbolTable());
throw new Error("The class in the location declaration '" + decl + "' does not exist at "
+ msg);
}
SSJavaLattice<String> localLattice = CompositeLattice.getLatticeByDescriptor(md);
Location localLoc = new Location(md, localLocId);
if (localLattice == null || (!localLattice.containsKey(localLocId))) {
- System.out.println("locDec=" + locDec);
throw new Error("Location " + localLocId
+ " is not defined in the local variable lattice at "
+ md.getClassDesc().getSourceFileName() + "::" + (n != null ? n.getNumLine() : md) + ".");
public static boolean isGreaterThan(CompositeLocation loc1, CompositeLocation loc2, String msg) {
- System.out.println("\nisGreaterThan=" + loc1 + " " + loc2 + " msg=" + msg);
+// System.out.println("\nisGreaterThan=" + loc1 + " " + loc2 + " msg=" + msg);
int baseCompareResult = compareBaseLocationSet(loc1, loc2, true, false, msg);
if (baseCompareResult == ComparisonResult.EQUAL) {
if (compareDelta(loc1, loc2) == ComparisonResult.GREATER) {
public static int compare(CompositeLocation loc1, CompositeLocation loc2, boolean ignore,
String msg) {
- System.out.println("compare=" + loc1 + " " + loc2);
+// System.out.println("compare=" + loc1 + " " + loc2);
int baseCompareResult = compareBaseLocationSet(loc1, loc2, false, ignore, msg);
if (baseCompareResult == ComparisonResult.EQUAL) {
public static CompositeLocation calculateGLB(Set<CompositeLocation> inputSet, String errMsg) {
- System.out.println("Calculating GLB=" + inputSet);
+// System.out.println("Calculating GLB=" + inputSet);
CompositeLocation glbCompLoc = new CompositeLocation();
// calculate GLB of the first(priority) element
}
}
- System.out.println("GLB=" + glbCompLoc);
+// System.out.println("GLB=" + glbCompLoc);
return glbCompLoc;
}