private CompositeLocation checkLocationFromIfStatementNode(MethodDescriptor md,
SymbolTable nametable, IfStatementNode isn, CompositeLocation constraint) {
- System.out.println("checkLocationFromIfStatementNode=" + isn);
+ System.out.println("\n\ncheckLocationFromIfStatementNode=" + isn.printNode(0));
CompositeLocation condLoc =
checkLocationFromExpressionNode(md, nametable, isn.getCondition(), new CompositeLocation(),
constraint, false);
if (!argLocation.get(0).isTop()
&& CompositeLattice.compare(argLocation, constraint, true,
- generateErrorMessage(cd, min)) == ComparisonResult.LESS) {
+ generateErrorMessage(cd, min)) == ComparisonResult.GREATER) {
CompositeLocation paramLocation = calleeParamList.get(idx);
+ " paramCompareResult=" + paramCompareResult);
if (!(paramLocation.get(0).equals(calleePCLOC.get(0)) && calleePCLOC.getSize() > 1)
- && paramCompareResult != ComparisonResult.LESS) {
+ && paramCompareResult != ComparisonResult.GREATER) {
throw new Error(
- "The program counter location "
- + constraint
- + " is lower than the argument(idx="
+ "The argument(idx="
+ idx
+ ") location "
+ argLocation
+ + "is higher than the caller program counter location "
+ + constraint
+ ". Need to specify that the initial PC location of the callee, which is currently set to "
- + calleePCLOC + ", is lower than " + paramLocation + " in the method "
+ + calleePCLOC + ", is not higher than " + paramLocation + " in the method "
+ calleeMethodDesc.getSymbol() + ":" + min.getNumLine());
}
MethodDescriptor calleemd = min.getMethod();
+ if (calleemd.isStatic()) {
+ return;
+ }
+
List<CompositeLocation> callerArgList = new ArrayList<CompositeLocation>();
List<CompositeLocation> calleeParamList = new ArrayList<CompositeLocation>();
private CompositeLocation checkLocationFromArrayAccessNode(MethodDescriptor md,
SymbolTable nametable, ArrayAccessNode aan, CompositeLocation constraint, boolean isLHS) {
- // System.out.println("aan=" + aan.printNode(0) + " line#=" + aan.getNumLine());
+ System.out.println("aan=" + aan.printNode(0) + " line#=" + aan.getNumLine());
ClassDescriptor cd = md.getClassDesc();
-
+ System.out.println("aan.getExpression()=" + aan.getExpression().getClass());
CompositeLocation arrayLoc =
checkLocationFromExpressionNode(md, nametable, aan.getExpression(),
new CompositeLocation(), constraint, isLHS);
-
+ System.out.println("HERE?");
// addTypeLocation(aan.getExpression().getType(), arrayLoc);
CompositeLocation indexLoc =
checkLocationFromExpressionNode(md, nametable, aan.getIndex(), new CompositeLocation(),
constraint, isLHS);
// addTypeLocation(aan.getIndex().getType(), indexLoc);
+ System.out.println("HERE2?");
if (isLHS) {
if (!CompositeLattice.isGreaterThan(indexLoc, arrayLoc, generateErrorMessage(cd, aan))) {
Set<CompositeLocation> inputGLB = new HashSet<CompositeLocation>();
inputGLB.add(arrayLoc);
inputGLB.add(indexLoc);
- return CompositeLattice.calculateGLB(inputGLB, generateErrorMessage(cd, aan));
+ System.out.println("arrayLoc=" + arrayLoc + " indexLoc=" + indexLoc);
+ CompositeLocation comp =
+ CompositeLattice.calculateGLB(inputGLB, generateErrorMessage(cd, aan));
+ System.out.println("---aan=" + aan.printNode(0) + " compLoc=" + comp);
+ return comp;
}
}
// addTypeLocation(on.getRight().getType(), rightLoc);
}
- // System.out.println("\n# OP NODE=" + on.printNode(0));
+ System.out.println("\n# OP NODE=" + on.printNode(0));
// System.out.println("# left loc=" + leftLoc + " from " +
// on.getLeft().getClass());
// if (on.getRight() != null) {
private CompositeLocation checkLocationFromNameNode(MethodDescriptor md, SymbolTable nametable,
NameNode nn, CompositeLocation loc, CompositeLocation constraint) {
+ // System.out.println("checkLocationFromNameNode nn=" + nn.printNode(0));
NameDescriptor nd = nn.getName();
if (nd.getBase() != null) {
loc =
} else if (d instanceof FieldDescriptor) {
// the type of field descriptor has a location!
FieldDescriptor fd = (FieldDescriptor) d;
+ // System.out.println("fd=" + fd);
if (fd.isStatic()) {
if (fd.isFinal()) {
// if it is 'static final', the location has TOP since no one can
loc.addLocation(Location.createTopLocation(md));
return loc;
} else {
+
// if 'static', the location has pre-assigned global loc
MethodLattice<String> localLattice = ssjava.getMethodLattice(md);
String globalLocId = localLattice.getGlobalLoc();
throw new Error("Global location element is not defined in the method " + md);
}
Location globalLoc = new Location(md, globalLocId);
-
+ System.out.println("static=" + globalLoc);
loc.addLocation(globalLoc);
}
} else {
private CompositeLocation checkLocationFromAssignmentNode(MethodDescriptor md,
SymbolTable nametable, AssignmentNode an, CompositeLocation loc, CompositeLocation constraint) {
+ System.out.println("\n\ncheckLocationFromAssignmentNode=" + an.printNode(0));
+
ClassDescriptor cd = md.getClassDesc();
Set<CompositeLocation> inputGLBSet = new HashSet<CompositeLocation>();
// generateErrorMessage(cd, an));
}
- // System.out.println("src=" + srcLocation + " dest=" + destLocation + " const=" +
- // constraint);
+ System.out.println("src=" + srcLocation + " dest=" + destLocation + " const=" + constraint);
if (!CompositeLattice.isGreaterThan(srcLocation, destLocation, generateErrorMessage(cd, an))) {
}
if (innerGLBInput.size() > 0) {
+ // System.out.println("######innerGLBInput=" + innerGLBInput);
CompositeLocation innerGLB = CompositeLattice.calculateGLB(innerGLBInput, errMsg);
for (int idx = 0; idx < innerGLB.getSize(); idx++) {
glbCompLoc.addLocation(innerGLB.get(idx));
}
}
- System.out.println("GLB=" + glbCompLoc + "\n");
+ System.out.println("GLB=" + glbCompLoc);
return glbCompLoc;
}