- int compareResult =
- CompositeLattice.compare(constraint, baseLocation, true, generateErrorMessage(cd, min));
-
- if (compareResult == ComparisonResult.LESS) {
- throw new Error("Method invocation does not respect the current branch constraint at "
- + generateErrorMessage(cd, min));
- } else if (compareResult != ComparisonResult.GREATER) {
- // if the current constraint is higher than method's THIS location
- // no need to check constraints!
- CompositeLocation calleeConstraint =
- translateCallerLocToCalleeLoc(calleeMD, baseLocation, constraint);
- System.out.println("check method body for constraint:" + calleeMD + " calleeConstraint="
- + calleeConstraint);
- checkMethodBody(calleeMD.getClassDesc(), calleeMD, calleeConstraint);
+ // check whether the PC location is lower than one of the
+ // argument locations. If it is lower, the callee has to have @PCLOC
+ // annotation that declares the program counter that is higher than
+ // corresponding parameter
+
+ CompositeLocation calleePCLOC = ssjava.getPCLocation(calleeMethodDesc);
+
+ for (int idx = 0; idx < callerArgList.size(); idx++) {
+ CompositeLocation argLocation = callerArgList.get(idx);
+
+ // if the PC location is lower than an argument location
+ // then, need to check that the callee's the initial location for the PC is also lower
+ // than the corresponding parameter location
+
+ if (!argLocation.get(0).isTop()
+ && CompositeLattice.compare(argLocation, constraint, true,
+ generateErrorMessage(cd, min)) == ComparisonResult.LESS) {
+
+ CompositeLocation paramLocation = calleeParamList.get(idx);
+
+ int paramCompareResult =
+ CompositeLattice.compare(paramLocation, calleePCLOC, true,
+ generateErrorMessage(cd, min));
+ // CompositeLattice.compare(calleePCLOC, paramLocation, true,
+ // generateErrorMessage(cd, min));
+
+ System.out.println("-CHECKPCLOC:");
+ System.out.println("---ARG LOC="
+ + argLocation
+ + " callerPCLOC="
+ + constraint
+ + " result="
+ + CompositeLattice.compare(argLocation, constraint, true,
+ generateErrorMessage(cd, min)));
+ System.out.println("---PARAM LOC=" + paramLocation + " calleePCLOC=" + calleePCLOC
+ + " paramCompareResult=" + paramCompareResult);
+
+ if (!(paramLocation.get(0).equals(calleePCLOC.get(0)) && calleePCLOC.getSize() > 1)
+ && paramCompareResult != ComparisonResult.LESS) {
+ throw new Error(
+ "The program counter location "
+ + constraint
+ + " is lower than the argument(idx="
+ + idx
+ + ") location "
+ + argLocation
+ + ". Need to specify that the initial PC location of the callee, which is currently set to "
+ + calleePCLOC + ", is lower than " + paramLocation + " in the method "
+ + calleeMethodDesc.getSymbol() + ":" + min.getNumLine());
+ }
+
+ }
+