private void checkCalleeConstraints(MethodDescriptor md, SymbolTable nametable,
MethodInvokeNode min, CompositeLocation callerBaseLoc, CompositeLocation constraint) {
- // System.out.println("checkCalleeConstraints=" + min.printNode(0));
-
MethodDescriptor calleemd = min.getMethod();
MethodLattice<String> calleeLattice = ssjava.getMethodLattice(calleemd);
+
CompositeLocation calleeThisLoc =
new CompositeLocation(new Location(calleemd, calleeLattice.getThisLoc()));
// setup caller args set
// first, add caller's base(this) location
- callerArgList.add(callerBaseLoc);
+ if (!calleemd.isStatic())
+ callerArgList.add(callerBaseLoc);
// second, add caller's arguments
for (int i = 0; i < min.numArgs(); i++) {
ExpressionNode en = min.getArg(i);
// setup callee params set
// first, add callee's this location
- calleeParamList.add(calleeThisLoc);
+ if (!calleemd.isStatic())
+ calleeParamList.add(calleeThisLoc);
// second, add callee's parameters
for (int i = 0; i < calleemd.numParameters(); i++) {
VarDescriptor calleevd = (VarDescriptor) calleemd.getParameter(i);
}
}
+ Set<CompositeLocation> inputGLB = new HashSet<CompositeLocation>();
if (left instanceof ArrayAccessNode) {
ArrayAccessNode aan = (ArrayAccessNode) left;
- left = aan.getExpression();
+ CompositeLocation indexLoc =
+ checkLocationFromExpressionNode(md, nametable, aan.getIndex(), loc, constraint, false);
+ inputGLB.add(indexLoc);
}
loc = checkLocationFromExpressionNode(md, nametable, left, loc, constraint, false);
- // System.out.println("### checkLocationFromFieldAccessNode=" +
- // fan.printNode(0));
- // System.out.println("### left=" + left.printNode(0));
if (!left.getType().isPrimitive()) {
- if (fd.getSymbol().equals("length")) {
+ if (!fd.getSymbol().equals("length")) {
// array.length access, return the location of the array
- return loc;
+ Location fieldLoc = getFieldLocation(fd);
+ loc.addLocation(fieldLoc);
}
- Location fieldLoc = getFieldLocation(fd);
- loc.addLocation(fieldLoc);
}
+
+ inputGLB.add(loc);
+ loc = CompositeLattice.calculateGLB(inputGLB, generateErrorMessage(md.getClassDesc(), fan));
return loc;
}
if (isCompositeLocation(inNodeInferLoc)) {
// need to make sure that newLocSymbol is lower than the infernode
// location in the field lattice
-
addRelation(methodLattice, methodInfo, inNodeInferLoc, inferLocation);
}
continue;
}
-
- CompositeLocation outNodeInferLoc= generateInferredCompositeLocation(methodInfo, flowGraph.getLocationTuple(localOutNode));
+ CompositeLocation outNodeInferLoc =
+ generateInferredCompositeLocation(methodInfo,
+ flowGraph.getLocationTuple(localOutNode));
if (isCompositeLocation(outNodeInferLoc)) {
// need to make sure that newLocSymbol is higher than the infernode
// location
-
+
addRelation(methodLattice, methodInfo, inferLocation, outNodeInferLoc);
}
// return;
// }
Set<String> cycleElementSet = lattice.getPossibleCycleElements(higher, lower);
- System.out.println("#Check cycle=" + lower + " < " + higher);
- System.out.println("#cycleElementSet=" + cycleElementSet);
boolean hasNonPrimitiveElement = false;
for (Iterator iterator = cycleElementSet.iterator(); iterator.hasNext();) {
}
if (hasNonPrimitiveElement) {
+ System.out.println("#Check cycle= " + lower + " < " + higher + " cycleElementSet="
+ + cycleElementSet);
// if there is non-primitive element in the cycle, no way to merge cyclic
// elements into the shared location
throw new CyclicFlowException();
case Kind.FieldAccessNode:
flowTuple =
analyzeFlowFieldAccessNode(md, nametable, (FieldAccessNode) en, nodeSet, base,
- implicitFlowTupleSet);
+ implicitFlowTupleSet, isLHS);
if (flowTuple != null) {
nodeSet.addTuple(flowTuple);
}
private NTuple<Descriptor> analyzeFlowFieldAccessNode(MethodDescriptor md, SymbolTable nametable,
FieldAccessNode fan, NodeTupleSet nodeSet, NTuple<Descriptor> base,
- NodeTupleSet implicitFlowTupleSet) {
+ NodeTupleSet implicitFlowTupleSet, boolean isLHS) {
ExpressionNode left = fan.getExpression();
TypeDescriptor ltd = left.getType();
}
if (left instanceof ArrayAccessNode) {
+
ArrayAccessNode aan = (ArrayAccessNode) left;
left = aan.getExpression();
+ analyzeFlowExpressionNode(md, nametable, aan.getIndex(), nodeSet, base, implicitFlowTupleSet,
+ isLHS);
}
// fanNodeSet
base =
- analyzeFlowExpressionNode(md, nametable, left, nodeSet, base, implicitFlowTupleSet, false);
+ analyzeFlowExpressionNode(md, nametable, left, nodeSet, base, implicitFlowTupleSet, isLHS);
if (base == null) {
// in this case, field is TOP location
return null;
if (!left.getType().isPrimitive()) {
- if (fd.getSymbol().equals("length")) {
+ if (!fd.getSymbol().equals("length")) {
// array.length access, just have the location of the array
- } else {
base.add(fd);
}
addFlowGraphEdge(md, tuple, tuple);
}
+ // creates edges from implicitFlowTupleSet to LHS
+ for (Iterator<NTuple<Descriptor>> iter = implicitFlowTupleSet.iterator(); iter.hasNext();) {
+ NTuple<Descriptor> fromTuple = iter.next();
+ for (Iterator<NTuple<Descriptor>> iter2 = nodeSetLHS.iterator(); iter2.hasNext();) {
+ NTuple<Descriptor> toTuple = iter2.next();
+ addFlowGraphEdge(md, fromTuple, toTuple);
+ }
+ }
+
}
}
// MDM: removed, as this wasn't being used.
// private float CheckSumOut1d = 0.0f;
- @LOC("SI1")
+ @LOC("IS1D")
private int CheckSumHuff = 0;
@LOC("IS1D")
private int[] is_1d;
private void huffman_decode(@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_start_local,
@LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
- @LOC("RE") int x[] = new int[1];
- @LOC("RE") int y[] = new int[1];
- @LOC("RE") int v[] = new int[1];
- @LOC("RE") int w[] = new int[1];
+ @LOC("THIS,LayerIIIDecoder.IS1D") int x[] = new int[1];
+ @LOC("THIS,LayerIIIDecoder.IS1D") int y[] = new int[1];
+ @LOC("THIS,LayerIIIDecoder.IS1D") int v[] = new int[1];
+ @LOC("THIS,LayerIIIDecoder.IS1D") int w[] = new int[1];
@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_3_end =
part2_start_local + si.ch[ch].gr[gr].part2_3_length;
* Do the huffman-decoding. note! for counta,countb -the 4 bit value is\r
* returned in y, discard x.\r
*/\r
- @LATTICE("OUT<V1,THIS<V1,V1<V,V<IN,IN<C,C*,V*,THISLOC=THIS,GLOBALLOC=IN")\r
+// @LATTICE("OUT<V1, THIS<V1,V1<V,V<IN,IN<C,C*,V*,THISLOC=THIS,GLOBALLOC=IN")\r
+ @LATTICE("OUT<THIS, THIS<V1,V1<V,V<IN,IN<C,C*,V*,THISLOC=THIS,GLOBALLOC=IN")\r
@RETURNLOC("OUT,BitReserve.BIT")\r
@PCLOC("OUT,BitReserve.BIT")\r
public static int huffman_decoder(@LOC("THIS,LayerIIIDecoder.SI2") int htIdx,\r
@LOC("OUT,BitReserve.BIT") int[] x, @LOC("OUT,BitReserve.BIT") int[] y,\r
@LOC("OUT,BitReserve.BIT") int[] v, @LOC("OUT,BitReserve.BIT") int[] w,\r
- @LOC("OUT") BitReserve br) {\r
+ @LOC("V1") BitReserve br) {\r
// array of all huffcodtable headers\r
// 0..31 Huffman code table 0..31\r
// 32,33 count1-tables\r