- int compareResult =
- CompositeLattice.compare(constraint, baseLocation, true, generateErrorMessage(cd, min));
- 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);
+
+ // need to check that param is higher than PCLOC
+ if (!argLocation.get(0).isTop()
+ && CompositeLattice.compare(argLocation, constraint, true,
+ generateErrorMessage(cd, min)) == ComparisonResult.GREATER) {
+
+ CompositeLocation paramLocation = calleeParamList.get(idx);
+
+ int paramCompareResult =
+ CompositeLattice.compare(calleePCLOC, paramLocation, true,
+ generateErrorMessage(cd, min));
+
+ if (paramCompareResult == ComparisonResult.GREATER) {
+ 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());
+ }
+
+ }
+