X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FAnalysis%2FSSJava%2FFlowDownCheck.java;h=4dd4eaf2b7e3a55d5d69df956c892b31d73dd244;hb=c23b147701988827b3b12133349c649510a04ecf;hp=f3d34a55705f4a4b60fb1fcd472d8ecce3387c8a;hpb=9dfdca00acf795117136425841493a1b0f036f10;p=IRC.git diff --git a/Robust/src/Analysis/SSJava/FlowDownCheck.java b/Robust/src/Analysis/SSJava/FlowDownCheck.java index f3d34a55..4dd4eaf2 100644 --- a/Robust/src/Analysis/SSJava/FlowDownCheck.java +++ b/Robust/src/Analysis/SSJava/FlowDownCheck.java @@ -707,7 +707,7 @@ public class FlowDownCheck { 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); @@ -1032,7 +1032,7 @@ public class FlowDownCheck { 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); @@ -1054,16 +1054,16 @@ public class FlowDownCheck { + " 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()); } @@ -1122,6 +1122,10 @@ public class FlowDownCheck { MethodDescriptor calleemd = min.getMethod(); + if (calleemd.isStatic()) { + return; + } + List callerArgList = new ArrayList(); List calleeParamList = new ArrayList(); @@ -1361,18 +1365,19 @@ public class FlowDownCheck { 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))) { @@ -1384,7 +1389,11 @@ public class FlowDownCheck { Set inputGLB = new HashSet(); 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; } } @@ -1416,7 +1425,7 @@ public class FlowDownCheck { // 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) { @@ -1483,6 +1492,7 @@ public class FlowDownCheck { 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 = @@ -1514,6 +1524,7 @@ public class FlowDownCheck { } 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 @@ -1521,6 +1532,7 @@ public class FlowDownCheck { loc.addLocation(Location.createTopLocation(md)); return loc; } else { + // if 'static', the location has pre-assigned global loc MethodLattice localLattice = ssjava.getMethodLattice(md); String globalLocId = localLattice.getGlobalLoc(); @@ -1528,7 +1540,7 @@ public class FlowDownCheck { 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 { @@ -1654,6 +1666,8 @@ public class FlowDownCheck { 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 inputGLBSet = new HashSet(); @@ -1705,8 +1719,7 @@ public class FlowDownCheck { // 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))) { @@ -2250,6 +2263,7 @@ public class FlowDownCheck { } 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)); @@ -2272,7 +2286,7 @@ public class FlowDownCheck { } } - System.out.println("GLB=" + glbCompLoc + "\n"); + System.out.println("GLB=" + glbCompLoc); return glbCompLoc; }