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);
+ }
+ }
+
}
}