+ private MethodDescriptor getHighestOverriddenMethod(ClassDescriptor curClassDesc,
+ MethodDescriptor curMethodDesc) {
+
+ // Node<ClassDescriptor> curNode = inheritanceTree.getTreeNode(curClassDesc);
+ // Node<ClassDescriptor> parentNode = curNode.getParent();
+ ClassDescriptor parentClassDesc = curClassDesc.getSuperDesc();
+
+ if (parentClassDesc != null) {
+ if (parentClassDesc.getMethodTable().contains(curMethodDesc.getSymbol())) {
+ Set<MethodDescriptor> methodDescSet =
+ parentClassDesc.getMethodTable().getSet(curMethodDesc.getSymbol());
+ for (Iterator iterator = methodDescSet.iterator(); iterator.hasNext();) {
+ MethodDescriptor md = (MethodDescriptor) iterator.next();
+ if (md.matches(curMethodDesc)) {
+ return getHighestOverriddenMethod(parentClassDesc, md);
+ }
+ }
+ }
+ // traverse to the parent!
+ return getHighestOverriddenMethod(parentClassDesc, curMethodDesc);
+ }
+ return curMethodDesc;
+ }
+
+ private void buildInheritanceTree() {
+
+ DFSInheritanceTreeCalculatingHighestOverriddenMethod(rootClassDescriptor);
+
+ }
+
+ private void addInheritanceConstraintsToHierarchyGraph() {
+
+ // DFS the inheritance tree and propagates nodes/edges of parent to child
+
+ // Node<ClassDescriptor> rootNode = inheritanceTree.getRootNode();
+ DFSInheritanceTree(rootClassDescriptor);
+
+ }
+
+ private void DFSInheritanceTree(ClassDescriptor parentClassDescriptor) {
+
+ // ClassDescriptor parentClassDescriptor = parentNode.getData();
+
+ Set<ClassDescriptor> children = getDirectSubClasses(parentClassDescriptor);
+ for (Iterator iterator = children.iterator(); iterator.hasNext();) {
+ ClassDescriptor childClassDescriptor = (ClassDescriptor) iterator.next();
+
+ HierarchyGraph parentGraph = getHierarchyGraph(parentClassDescriptor);
+ HierarchyGraph childGraph = getHierarchyGraph(childClassDescriptor);
+
+ Set<HNode> parentNodeSet = parentGraph.getNodeSet();
+ for (Iterator iterator2 = parentNodeSet.iterator(); iterator2.hasNext();) {
+ HNode hNode = (HNode) iterator2.next();
+ childGraph.addNode(hNode);
+ }
+
+ // copies extra information from the parent hierarchy graph
+ Map<HNode, Set<HNode>> parentMergeNodeMap = parentGraph.getMapHNodetoMergeSet();
+ Map<HNode, Set<HNode>> childMergeNodeMap = childGraph.getMapHNodetoMergeSet();
+
+ Set<HNode> keySet = parentMergeNodeMap.keySet();
+ for (Iterator iterator2 = keySet.iterator(); iterator2.hasNext();) {
+ HNode parentKey = (HNode) iterator2.next();
+ if (!childMergeNodeMap.containsKey(parentKey)) {
+ childMergeNodeMap.put(parentKey, new HashSet<HNode>());
+ }
+ childMergeNodeMap.get(parentKey).addAll(parentMergeNodeMap.get(parentKey));
+ }
+
+ // copies nodes/edges from the parent class...
+ for (Iterator iterator2 = parentNodeSet.iterator(); iterator2.hasNext();) {
+ HNode parentHNode = (HNode) iterator2.next();
+
+ Set<HNode> parentIncomingHNode = parentGraph.getIncomingNodeSet(parentHNode);
+ Set<HNode> parentOutgoingHNode = parentGraph.getOutgoingNodeSet(parentHNode);
+
+ for (Iterator iterator3 = parentIncomingHNode.iterator(); iterator3.hasNext();) {
+ HNode inHNode = (HNode) iterator3.next();
+ childGraph.addEdge(inHNode.getDescriptor(), parentHNode.getDescriptor());
+ }
+
+ for (Iterator iterator3 = parentOutgoingHNode.iterator(); iterator3.hasNext();) {
+ HNode outHNode = (HNode) iterator3.next();
+ childGraph.addEdge(parentHNode.getDescriptor(), outHNode.getDescriptor());
+ }
+
+ }
+
+ // copies nodes/edges from parent methods to overridden methods
+
+ for (Iterator iterator3 = childClassDescriptor.getMethods(); iterator3.hasNext();) {
+ MethodDescriptor childMethodDescriptor = (MethodDescriptor) iterator3.next();
+
+ MethodDescriptor parentMethodDesc =
+ getParentMethodDesc(childMethodDescriptor.getClassDesc(), childMethodDescriptor);
+
+ if (parentMethodDesc != null) {
+
+ HierarchyGraph parentMethodGraph = getHierarchyGraph(parentMethodDesc);
+ HierarchyGraph childMethodGraph = getHierarchyGraph(childMethodDescriptor);
+
+ Set<HNode> parentMethodNodeSet = parentMethodGraph.getNodeSet();
+ for (Iterator iterator2 = parentMethodNodeSet.iterator(); iterator2.hasNext();) {
+ HNode hNode = (HNode) iterator2.next();
+ childMethodGraph.addNode(hNode);
+ }
+
+ // copies extra information from the parent hierarchy graph
+ Map<HNode, Set<HNode>> parentMethodMergeNodeMap =
+ parentMethodGraph.getMapHNodetoMergeSet();
+ Map<HNode, Set<HNode>> childMethodMergeNodeMap = childMethodGraph.getMapHNodetoMergeSet();
+
+ Set<HNode> methodKeySet = parentMethodMergeNodeMap.keySet();
+ for (Iterator iterator2 = methodKeySet.iterator(); iterator2.hasNext();) {
+ HNode parentKey = (HNode) iterator2.next();
+ if (!childMethodMergeNodeMap.containsKey(parentKey)) {
+ childMethodMergeNodeMap.put(parentKey, new HashSet<HNode>());
+ }
+ childMethodMergeNodeMap.get(parentKey).addAll(parentMethodMergeNodeMap.get(parentKey));
+ }
+
+ // copies nodes/edges from the parent method...
+ for (Iterator iterator2 = parentMethodGraph.getNodeSet().iterator(); iterator2.hasNext();) {
+ HNode parentHNode = (HNode) iterator2.next();
+
+ Set<HNode> parentIncomingHNode = parentMethodGraph.getIncomingNodeSet(parentHNode);
+ Set<HNode> parentOutgoingHNode = parentMethodGraph.getOutgoingNodeSet(parentHNode);
+
+ for (Iterator iterator4 = parentIncomingHNode.iterator(); iterator4.hasNext();) {
+ HNode inHNode = (HNode) iterator4.next();
+ childMethodGraph.addEdge(inHNode, parentHNode);
+ }
+
+ for (Iterator iterator4 = parentOutgoingHNode.iterator(); iterator4.hasNext();) {
+ HNode outHNode = (HNode) iterator4.next();
+ childMethodGraph.addEdge(parentHNode, outHNode);
+ }
+
+ }
+
+ }
+
+ }
+
+ DFSInheritanceTree(childClassDescriptor);
+ }
+
+ }
+
+ public MethodDescriptor getParentMethodDesc(ClassDescriptor classDesc, MethodDescriptor methodDesc) {
+
+ // Node<ClassDescriptor> childNode = inheritanceTree.getTreeNode(classDesc);
+ ClassDescriptor parentClassDesc = classDesc.getSuperDesc();
+ // Node<ClassDescriptor> parentNode = childNode.getParent();
+
+ if (parentClassDesc != null) {
+ // ClassDescriptor parentClassDesc = parentNode.getData();
+ if (parentClassDesc.getMethodTable().contains(methodDesc.getSymbol())) {
+ Set<MethodDescriptor> methodDescSet =
+ parentClassDesc.getMethodTable().getSet(methodDesc.getSymbol());
+ for (Iterator iterator = methodDescSet.iterator(); iterator.hasNext();) {
+ MethodDescriptor md = (MethodDescriptor) iterator.next();
+ if (md.matches(methodDesc)) {
+ return md;
+ }
+ }
+ }
+
+ // traverse to the parent!
+ getParentMethodDesc(parentClassDesc, methodDesc);
+
+ }
+
+ return null;
+ }
+
+ private void checkReturnNodes() {
+ LinkedList<MethodDescriptor> methodDescList =
+ (LinkedList<MethodDescriptor>) toanalyze_methodDescList.clone();
+
+ while (!methodDescList.isEmpty()) {
+ MethodDescriptor md = methodDescList.removeLast();
+
+ if (md.getReturnType() != null && !md.getReturnType().isVoid()) {
+ checkFlowNodeReturnThisField(md);
+ }
+ // // in this case, this method will return the composite location that starts with 'this'
+ // FlowGraph flowGraph = getFlowGraph(md);
+ // Set<FlowNode> returnNodeSet = flowGraph.getReturnNodeSet();
+ // }
+
+ }
+
+ }
+
+ private void addSuperClasses(ClassDescriptor cd) {
+ ClassDescriptor parentClassDesc = cd.getSuperDesc();
+ if (parentClassDesc != null) {
+ toanalyze_classDescSet.add(parentClassDesc);
+ addSuperClasses(parentClassDesc);
+ }
+ }
+
+ private void updateFlowGraph() {
+
+ LinkedList<MethodDescriptor> methodDescList =
+ (LinkedList<MethodDescriptor>) toanalyze_methodDescList.clone();
+
+ while (!methodDescList.isEmpty()) {
+ MethodDescriptor md = methodDescList.removeLast();
+ if (state.SSJAVADEBUG) {
+ System.out.println();
+ System.out.println("SSJAVA: Updating a flow graph: " + md);
+ propagateFlowsFromCalleesWithNoCompositeLocation(md);
+ }
+
+ Set<FlowNode> nodeSet = getFlowGraph(md).getNodeSet();
+ for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
+ FlowNode flowNode = (FlowNode) iterator.next();
+ NTuple<Descriptor> descTuple = flowNode.getCurrentDescTuple();
+ NTuple<Location> locTuple = translateToLocTuple(md, descTuple);
+ for (int i = 0; i < locTuple.size(); i++) {
+ Location loc = locTuple.get(i);
+ if (loc.getDescriptor() instanceof ClassDescriptor) {
+ ClassDescriptor classDesc = (ClassDescriptor) loc.getDescriptor();
+ toanalyze_classDescSet.add(classDesc);
+ addSuperClasses(classDesc);
+ } else if (loc.getDescriptor() instanceof MethodDescriptor) {
+ toanalyze_classDescSet.add(((MethodDescriptor) loc.getDescriptor()).getClassDesc());
+ }
+ }
+
+ }
+
+ }
+ }
+
+ public Map<NTuple<Descriptor>, NTuple<Descriptor>> getMapCallerArgToCalleeParam(
+ MethodInvokeNode min) {
+
+ if (!mapMethodInvokeNodeToMapCallerArgToCalleeArg.containsKey(min)) {
+ mapMethodInvokeNodeToMapCallerArgToCalleeArg.put(min,
+ new HashMap<NTuple<Descriptor>, NTuple<Descriptor>>());
+ }
+
+ return mapMethodInvokeNodeToMapCallerArgToCalleeArg.get(min);
+ }
+
+ public void addMapCallerArgToCalleeParam(MethodInvokeNode min, NTuple<Descriptor> callerArg,
+ NTuple<Descriptor> calleeParam) {
+ getMapCallerArgToCalleeParam(min).put(callerArg, calleeParam);
+ }
+
+ private void assignCompositeLocation() {
+ calculateGlobalValueFlowCompositeLocation();
+ translateCompositeLocationAssignmentToFlowGraph();
+ }
+
+ private void translateCompositeLocationAssignmentToFlowGraph() {
+ System.out.println("\nSSJAVA: Translate composite location assignments to flow graphs:");
+ MethodDescriptor methodEventLoopDesc = ssjava.getMethodContainingSSJavaLoop();
+ translateCompositeLocationAssignmentToFlowGraph(methodEventLoopDesc);
+ }
+
+ private void translateCompositeLocationAssignmentToFlowGraph2() {
+ System.out.println("\nSSJAVA: Translate composite location assignments to flow graphs:");
+ MethodDescriptor methodEventLoopDesc = ssjava.getMethodContainingSSJavaLoop();
+ translateCompositeLocationAssignmentToFlowGraph(methodEventLoopDesc);
+ }
+
+ private void addAdditionalOrderingConstraints() {
+ System.out.println("\nSSJAVA: Add addtional ordering constriants:");
+ MethodDescriptor methodEventLoopDesc = ssjava.getMethodContainingSSJavaLoop();
+ addAddtionalOrderingConstraints(methodEventLoopDesc);
+ // calculateReturnHolderLocation();
+ }
+
+ private void calculateReturnHolderLocation() {
+ LinkedList<MethodDescriptor> methodDescList =
+ (LinkedList<MethodDescriptor>) toanalyze_methodDescList.clone();
+
+ while (!methodDescList.isEmpty()) {
+ MethodDescriptor md = methodDescList.removeLast();
+
+ FlowGraph fg = getFlowGraph(md);
+ Set<FlowNode> nodeSet = fg.getNodeSet();
+ for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
+ FlowNode flowNode = (FlowNode) iterator.next();
+ if (flowNode.isFromHolder()) {
+ calculateCompositeLocationFromFlowGraph(md, flowNode);
+ }
+ }
+
+ }
+ }
+
+ private void updateCompositeLocationAssignments() {
+
+ LinkedList<MethodDescriptor> methodDescList =
+ (LinkedList<MethodDescriptor>) toanalyze_methodDescList.clone();
+
+ while (!methodDescList.isEmpty()) {
+ MethodDescriptor md = methodDescList.removeLast();
+
+ System.out.println("\n#updateCompositeLocationAssignments=" + md);
+
+ FlowGraph flowGraph = getFlowGraph(md);
+
+ MethodSummary methodSummary = getMethodSummary(md);
+
+ Set<FlowNode> nodeSet = flowGraph.getNodeSet();
+ for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
+ FlowNode node = (FlowNode) iterator.next();
+ System.out.println("-node=" + node + " node.getDescTuple=" + node.getDescTuple());
+ if (node.getCompositeLocation() != null) {
+ CompositeLocation compLoc = node.getCompositeLocation();
+ CompositeLocation updatedCompLoc = updateCompositeLocation(compLoc);
+ node.setCompositeLocation(updatedCompLoc);
+ System.out.println("---updatedCompLoc1=" + updatedCompLoc);
+ } else {
+ NTuple<Descriptor> descTuple = node.getDescTuple();
+ // System.out.println("update desc=" + descTuple);
+ CompositeLocation compLoc = convertToCompositeLocation(md, descTuple);
+ compLoc = updateCompositeLocation(compLoc);
+ node.setCompositeLocation(compLoc);
+ // System.out.println("---updatedCompLoc2=" + compLoc);
+ }
+
+ if (node.isDeclaratonNode()) {
+ Descriptor localVarDesc = node.getDescTuple().get(0);
+ CompositeLocation compLoc = updateCompositeLocation(node.getCompositeLocation());
+ methodSummary.addMapVarNameToInferCompLoc(localVarDesc, compLoc);
+ }
+ }
+
+ // update PCLOC and RETURNLOC if they have a composite location assignment
+ if (methodSummary.getRETURNLoc() != null) {
+ methodSummary.setRETURNLoc(updateCompositeLocation(methodSummary.getRETURNLoc()));
+ }
+ if (methodSummary.getPCLoc() != null) {
+ methodSummary.setPCLoc(updateCompositeLocation(methodSummary.getPCLoc()));
+ }
+
+ }
+
+ }
+
+ private CompositeLocation updateCompositeLocation(CompositeLocation compLoc) {
+ CompositeLocation updatedCompLoc = new CompositeLocation();
+ for (int i = 0; i < compLoc.getSize(); i++) {
+ Location loc = compLoc.get(i);
+ String nodeIdentifier = loc.getLocIdentifier();
+ Descriptor enclosingDesc = loc.getDescriptor();
+ String locName;
+ if (!enclosingDesc.equals(GLOBALDESC)) {
+ LocationSummary locSummary = getLocationSummary(enclosingDesc);
+ // HierarchyGraph scGraph = getSkeletonCombinationHierarchyGraph(enclosingDesc);
+ HierarchyGraph scGraph = getSimpleHierarchyGraph(enclosingDesc);
+ if (scGraph != null) {
+ HNode curNode = scGraph.getCurrentHNode(nodeIdentifier);
+ System.out.println(" nodeID=" + nodeIdentifier + " curNode=" + curNode
+ + " enclosingDesc=" + enclosingDesc);
+ if (curNode != null) {
+ nodeIdentifier = curNode.getName();
+ }
+ }
+ locName = locSummary.getLocationName(nodeIdentifier);
+ } else {
+ locName = nodeIdentifier;
+ }
+ Location updatedLoc = new Location(enclosingDesc, locName);
+ updatedCompLoc.addLocation(updatedLoc);
+ }
+
+ return updatedCompLoc;
+ }
+
+ private void translateCompositeLocationAssignmentToFlowGraph(MethodDescriptor mdCaller) {
+
+ // System.out.println("\n\n###translateCompositeLocationAssignmentToFlowGraph mdCaller="
+ // + mdCaller);
+
+ // First, assign a composite location to a node in the flow graph
+ GlobalFlowGraph callerGlobalFlowGraph = getSubGlobalFlowGraph(mdCaller);
+
+ FlowGraph callerFlowGraph = getFlowGraph(mdCaller);
+ Map<Location, CompositeLocation> callerMapLocToCompLoc =
+ callerGlobalFlowGraph.getMapLocationToInferCompositeLocation();
+
+ Set<Location> methodLocSet = callerMapLocToCompLoc.keySet();
+ for (Iterator iterator = methodLocSet.iterator(); iterator.hasNext();) {
+ Location methodLoc = (Location) iterator.next();
+ if (methodLoc.getDescriptor().equals(mdCaller)) {
+ CompositeLocation inferCompLoc = callerMapLocToCompLoc.get(methodLoc);
+ assignCompositeLocationToFlowGraph(callerFlowGraph, methodLoc, inferCompLoc);
+ }
+ }
+
+ Set<MethodInvokeNode> minSet = mapMethodDescriptorToMethodInvokeNodeSet.get(mdCaller);
+
+ Set<MethodDescriptor> calleeSet = new HashSet<MethodDescriptor>();
+ for (Iterator iterator = minSet.iterator(); iterator.hasNext();) {
+ MethodInvokeNode min = (MethodInvokeNode) iterator.next();
+ // need to translate a composite location that is started with the base
+ // tuple of 'min'.
+ translateMapLocationToInferCompositeLocationToCalleeGraph(callerGlobalFlowGraph, min);
+ MethodDescriptor mdCallee = min.getMethod();
+ calleeSet.add(mdCallee);
+
+ }
+
+ for (Iterator iterator = calleeSet.iterator(); iterator.hasNext();) {
+ MethodDescriptor callee = (MethodDescriptor) iterator.next();
+ translateCompositeLocationAssignmentToFlowGraph(callee);
+ }
+
+ }
+
+ private void addAddtionalOrderingConstraints(MethodDescriptor mdCaller) {
+
+ // First, assign a composite location to a node in the flow graph
+ GlobalFlowGraph callerGlobalFlowGraph = getSubGlobalFlowGraph(mdCaller);
+
+ FlowGraph callerFlowGraph = getFlowGraph(mdCaller);
+ Map<Location, CompositeLocation> callerMapLocToCompLoc =
+ callerGlobalFlowGraph.getMapLocationToInferCompositeLocation();
+ Set<Location> methodLocSet = callerMapLocToCompLoc.keySet();
+
+ Set<MethodInvokeNode> minSet = mapMethodDescriptorToMethodInvokeNodeSet.get(mdCaller);
+
+ Set<MethodDescriptor> calleeSet = new HashSet<MethodDescriptor>();
+ for (Iterator iterator = minSet.iterator(); iterator.hasNext();) {
+ MethodInvokeNode min = (MethodInvokeNode) iterator.next();
+ MethodDescriptor mdCallee = min.getMethod();
+ calleeSet.add(mdCallee);
+
+ //
+ // add an additional ordering constraint
+ // if the first element of a parameter composite location matches 'this' reference,
+ // the corresponding argument in the caller is required to be higher than the translated
+ // parameter location in the caller lattice
+ // TODO
+ // addOrderingConstraintFromCompLocParamToArg(mdCaller, min);
+
+ //
+ // update return flow nodes in the caller
+ CompositeLocation returnLoc = getMethodSummary(mdCallee).getRETURNLoc();
+ // System.out.println("### min=" + min.printNode(0) + " returnLoc=" + returnLoc);
+ if (returnLoc != null && returnLoc.get(0).getLocDescriptor().equals(mdCallee.getThis())
+ && returnLoc.getSize() > 1) {
+ // System.out.println("###RETURN COMP LOC=" + returnLoc);
+ NTuple<Location> returnLocTuple = returnLoc.getTuple();
+ NTuple<Descriptor> baseTuple = mapMethodInvokeNodeToBaseTuple.get(min);
+ // System.out.println("###basetuple=" + baseTuple);
+ NTuple<Descriptor> newReturnTuple = baseTuple.clone();
+ for (int i = 1; i < returnLocTuple.size(); i++) {
+ newReturnTuple.add(returnLocTuple.get(i).getLocDescriptor());
+ }
+ // System.out.println("###NEW RETURN TUPLE FOR CALLER=" + newReturnTuple);
+
+ FlowReturnNode holderNode = callerFlowGraph.getFlowReturnNode(min);
+ NodeTupleSet holderTupleSet =
+ getNodeTupleSetFromReturnNode(getFlowGraph(mdCaller), holderNode);
+
+ callerFlowGraph.getFlowReturnNode(min).setNewTuple(newReturnTuple);
+
+ // then need to remove old constraints
+ // TODO SAT
+ // System.out.println("###REMOVE OLD CONSTRAINTS=" + holderNode);
+ for (Iterator<NTuple<Descriptor>> iter = holderTupleSet.iterator(); iter.hasNext();) {
+ NTuple<Descriptor> tupleFromHolder = iter.next();
+ Set<FlowEdge> holderOutEdge = callerFlowGraph.getOutEdgeSet(holderNode);
+ for (Iterator iterator2 = holderOutEdge.iterator(); iterator2.hasNext();) {
+ FlowEdge outEdge = (FlowEdge) iterator2.next();
+ NTuple<Descriptor> toberemovedTuple = outEdge.getEndTuple();
+ // System.out.println("---remove " + tupleFromHolder + " -> " + toberemovedTuple);
+ callerFlowGraph.removeEdge(tupleFromHolder, toberemovedTuple);
+ }
+ }
+
+ } else {
+ // if the return loc set was empty and later pcloc was connected to the return loc
+ // need to make sure that return loc reflects to this changes.
+ FlowReturnNode flowReturnNode = callerFlowGraph.getFlowReturnNode(min);
+ if (flowReturnNode != null && flowReturnNode.getReturnTupleSet().isEmpty()) {
+
+ if (needToUpdateReturnLocHolder(min.getMethod(), flowReturnNode)) {
+ NTuple<Descriptor> baseTuple = mapMethodInvokeNodeToBaseTuple.get(min);
+ NTuple<Descriptor> newReturnTuple = baseTuple.clone();
+ flowReturnNode.addTuple(newReturnTuple);
+ }
+
+ }
+
+ }
+
+ }
+
+ for (Iterator iterator = calleeSet.iterator(); iterator.hasNext();) {
+ MethodDescriptor callee = (MethodDescriptor) iterator.next();
+ addAddtionalOrderingConstraints(callee);
+ }
+
+ }
+
+ private boolean needToUpdateReturnLocHolder(MethodDescriptor mdCallee,
+ FlowReturnNode flowReturnNode) {
+ FlowGraph fg = getFlowGraph(mdCallee);
+ MethodSummary summary = getMethodSummary(mdCallee);
+ CompositeLocation returnCompLoc = summary.getRETURNLoc();
+ NTuple<Descriptor> returnDescTuple = translateToDescTuple(returnCompLoc.getTuple());
+ Set<FlowNode> incomingNodeToReturnNode =
+ fg.getIncomingFlowNodeSet(fg.getFlowNode(returnDescTuple));
+ for (Iterator iterator = incomingNodeToReturnNode.iterator(); iterator.hasNext();) {
+ FlowNode inNode = (FlowNode) iterator.next();
+ if (inNode.getDescTuple().get(0).equals(mdCallee.getThis())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addMapMethodDescToMethodInvokeNodeSet(MethodInvokeNode min) {
+ MethodDescriptor md = min.getMethod();
+ if (!mapMethodDescToMethodInvokeNodeSet.containsKey(md)) {
+ mapMethodDescToMethodInvokeNodeSet.put(md, new HashSet<MethodInvokeNode>());
+ }
+ mapMethodDescToMethodInvokeNodeSet.get(md).add(min);
+ }
+
+ private Set<MethodInvokeNode> getMethodInvokeNodeSetByMethodDesc(MethodDescriptor md) {
+ if (!mapMethodDescToMethodInvokeNodeSet.containsKey(md)) {
+ mapMethodDescToMethodInvokeNodeSet.put(md, new HashSet<MethodInvokeNode>());
+ }
+ return mapMethodDescToMethodInvokeNodeSet.get(md);
+ }
+
+ public void assignCompositeLocationToFlowGraph(FlowGraph flowGraph, Location loc,
+ CompositeLocation inferCompLoc) {
+ Descriptor localDesc = loc.getLocDescriptor();
+
+ Set<FlowNode> nodeSet = flowGraph.getNodeSet();
+ for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
+ FlowNode node = (FlowNode) iterator.next();
+ if (node.getDescTuple().startsWith(localDesc)
+ && !node.getDescTuple().get(0).equals(LITERALDESC)) {
+ // need to assign the inferred composite location to this node
+ CompositeLocation newCompLoc = generateCompositeLocation(node.getDescTuple(), inferCompLoc);
+ node.setCompositeLocation(newCompLoc);
+ // System.out.println("SET Node=" + node + " inferCompLoc=" + newCompLoc);
+ }
+ }
+ }
+
+ private CompositeLocation generateCompositeLocation(NTuple<Descriptor> nodeDescTuple,
+ CompositeLocation inferCompLoc) {
+
+ // System.out.println("generateCompositeLocation=" + nodeDescTuple + " with inferCompLoc="
+ // + inferCompLoc);
+
+ MethodDescriptor md = (MethodDescriptor) inferCompLoc.get(0).getDescriptor();
+
+ CompositeLocation newCompLoc = new CompositeLocation();
+ for (int i = 0; i < inferCompLoc.getSize(); i++) {
+ newCompLoc.addLocation(inferCompLoc.get(i));
+ }
+
+ Descriptor lastDescOfPrefix = nodeDescTuple.get(0);
+ Descriptor enclosingDescriptor;
+ if (lastDescOfPrefix instanceof InterDescriptor) {
+ enclosingDescriptor = getFlowGraph(md).getEnclosingDescriptor(lastDescOfPrefix);
+ } else {
+ enclosingDescriptor = ((VarDescriptor) lastDescOfPrefix).getType().getClassDesc();
+ }
+
+ for (int i = 1; i < nodeDescTuple.size(); i++) {
+ Descriptor desc = nodeDescTuple.get(i);
+ Location locElement = new Location(enclosingDescriptor, desc);
+ newCompLoc.addLocation(locElement);
+
+ enclosingDescriptor = ((FieldDescriptor) desc).getClassDescriptor();
+ }
+
+ return newCompLoc;
+ }
+
+ private void translateMapLocationToInferCompositeLocationToCalleeGraph(
+ GlobalFlowGraph callerGraph, MethodInvokeNode min) {
+
+ MethodDescriptor mdCallee = min.getMethod();
+ MethodDescriptor mdCaller = callerGraph.getMethodDescriptor();
+ Map<Location, CompositeLocation> callerMapLocToCompLoc =
+ callerGraph.getMapLocationToInferCompositeLocation();
+
+ Map<Integer, NTuple<Descriptor>> mapIdxToArgTuple = mapMethodInvokeNodeToArgIdxMap.get(min);
+
+ FlowGraph calleeFlowGraph = getFlowGraph(mdCallee);
+ GlobalFlowGraph calleeGlobalGraph = getSubGlobalFlowGraph(mdCallee);
+
+ NTuple<Location> baseLocTuple = null;
+ if (mapMethodInvokeNodeToBaseTuple.containsKey(min)) {
+ baseLocTuple = translateToLocTuple(mdCaller, mapMethodInvokeNodeToBaseTuple.get(min));
+ }
+
+ // System.out.println("\n-#translate caller=" + mdCaller + " infer composite loc to callee="
+ // + mdCallee + " baseLocTuple=" + baseLocTuple);
+
+ Set<Location> keySet = callerMapLocToCompLoc.keySet();
+ for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
+ Location key = (Location) iterator.next();
+ CompositeLocation callerCompLoc = callerMapLocToCompLoc.get(key);
+
+ if (!key.getDescriptor().equals(mdCaller)) {
+
+ CompositeLocation newCalleeCompLoc;
+ if (baseLocTuple != null && callerCompLoc.getTuple().startsWith(baseLocTuple)) {
+ // System.out.println("-----need to translate callerCompLoc=" + callerCompLoc
+ // + " with baseTuple=" + baseLocTuple);
+ newCalleeCompLoc =
+ translateCompositeLocationToCallee(callerCompLoc, baseLocTuple, mdCallee);
+
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, newCalleeCompLoc);
+ // System.out.println("1---key=" + key + " callerCompLoc=" + callerCompLoc
+ // + " newCalleeCompLoc=" + newCalleeCompLoc);
+ // System.out.println("-----caller=" + mdCaller + " callee=" + mdCallee);
+ if (!newCalleeCompLoc.get(0).getDescriptor().equals(mdCallee)) {
+ System.exit(0);
+ }
+
+ // System.out.println("-----baseLoctuple=" + baseLocTuple);
+ } else {
+ // check if it is the global access
+ Location compLocFirstElement = callerCompLoc.getTuple().get(0);
+ if (compLocFirstElement.getDescriptor().equals(mdCallee)
+ && compLocFirstElement.getLocDescriptor().equals(GLOBALDESC)) {
+
+ newCalleeCompLoc = new CompositeLocation();
+ Location newMethodLoc = new Location(mdCallee, GLOBALDESC);
+
+ newCalleeCompLoc.addLocation(newMethodLoc);
+ for (int i = 1; i < callerCompLoc.getSize(); i++) {
+ newCalleeCompLoc.addLocation(callerCompLoc.get(i));
+ }
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, newCalleeCompLoc);
+ // System.out.println("2---key=" + key + " callerCompLoc=" + callerCompLoc
+ // + " newCalleeCompLoc=" + newCalleeCompLoc);
+ // System.out.println("-----caller=" + mdCaller + " callee=" + mdCallee);
+
+ } else {
+ int paramIdx = getParamIdx(callerCompLoc, mapIdxToArgTuple);
+ if (paramIdx == -1) {
+ // here, the first element of the current composite location comes from the current
+ // callee
+ // so transfer the same composite location to the callee
+ if (!calleeGlobalGraph.contrainsInferCompositeLocationMapKey(key)) {
+ if (callerCompLoc.get(0).getDescriptor().equals(mdCallee)) {
+ // System.out.println("3---key=" + key + " callerCompLoc=" + callerCompLoc
+ // + " newCalleeCompLoc=" + callerCompLoc);
+ // System.out.println("-----caller=" + mdCaller + " callee=" + mdCallee);
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, callerCompLoc);
+ } else {
+ // System.out.println("3---SKIP key=" + key + " callerCompLoc=" + callerCompLoc);
+ }
+ }
+ continue;
+ }
+
+ // It is the case where two parameters have relative orderings between them by having
+ // composite locations
+ // if we found the param idx, it means that the first part of the caller composite
+ // location corresponds to the one of arguments.
+ // for example, if the caller argument is <<caller.this>,<Decoder.br>>
+ // and the current caller composite location mapping
+ // <<caller.this>,<Decoder.br>,<Br.value>>
+ // and the parameter which matches with the caller argument is 'Br brParam'
+ // then, the translated callee composite location will be <<callee.brParam>,<Br.value>>
+ NTuple<Descriptor> argTuple = mapIdxToArgTuple.get(paramIdx);
+
+ FlowNode paramFlowNode = calleeFlowGraph.getParamFlowNode(paramIdx);
+ NTuple<Location> paramLocTuple =
+ translateToLocTuple(mdCallee, paramFlowNode.getDescTuple());
+ newCalleeCompLoc = new CompositeLocation();
+ for (int i = 0; i < paramLocTuple.size(); i++) {
+ newCalleeCompLoc.addLocation(paramLocTuple.get(i));
+ }
+ for (int i = argTuple.size(); i < callerCompLoc.getSize(); i++) {
+ newCalleeCompLoc.addLocation(callerCompLoc.get(i));
+ }
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(key, newCalleeCompLoc);
+ // System.out.println("4---key=" + key + " callerCompLoc=" + callerCompLoc
+ // + " newCalleeCompLoc=" + newCalleeCompLoc);
+ // System.out.println("-----caller=" + mdCaller + " callee=" + mdCallee);
+
+ }
+
+ }
+
+ }
+ }
+
+ // System.out.println("#ASSIGN COMP LOC TO CALLEE PARAMS: callee=" + mdCallee + " caller="
+ // + mdCaller);
+ // If the location of an argument has a composite location
+ // need to assign a proper composite location to the corresponding callee parameter
+ Set<Integer> idxSet = mapIdxToArgTuple.keySet();
+ for (Iterator iterator = idxSet.iterator(); iterator.hasNext();) {
+ Integer idx = (Integer) iterator.next();
+
+ if (idx == 0 && !min.getMethod().isStatic()) {
+ continue;
+ }
+
+ NTuple<Descriptor> argTuple = mapIdxToArgTuple.get(idx);
+ // System.out.println("-argTuple=" + argTuple + " idx=" + idx);
+ if (argTuple.size() > 0) {
+ // check if an arg tuple has been already assigned to a composite location
+ NTuple<Location> argLocTuple = translateToLocTuple(mdCaller, argTuple);
+ Location argLocalLoc = argLocTuple.get(0);
+
+ // if (!isPrimitiveType(argTuple)) {
+ if (callerMapLocToCompLoc.containsKey(argLocalLoc)) {
+
+ CompositeLocation callerCompLoc = callerMapLocToCompLoc.get(argLocalLoc);
+ for (int i = 1; i < argLocTuple.size(); i++) {
+ callerCompLoc.addLocation(argLocTuple.get(i));
+ }
+
+ // System.out.println("---callerCompLoc=" + callerCompLoc);
+
+ // if (baseLocTuple != null && callerCompLoc.getTuple().startsWith(baseLocTuple)) {
+
+ FlowNode calleeParamFlowNode = calleeFlowGraph.getParamFlowNode(idx);
+
+ NTuple<Descriptor> calleeParamDescTuple = calleeParamFlowNode.getDescTuple();
+ NTuple<Location> calleeParamLocTuple =
+ translateToLocTuple(mdCallee, calleeParamDescTuple);
+
+ int refParamIdx = getParamIdx(callerCompLoc, mapIdxToArgTuple);
+ // System.out.println("-----paramIdx=" + refParamIdx);
+ if (refParamIdx == 0 && !mdCallee.isStatic()) {
+
+ // System.out.println("-------need to translate callerCompLoc=" + callerCompLoc
+ // + " with baseTuple=" + baseLocTuple + " calleeParamLocTuple="
+ // + calleeParamLocTuple);
+
+ CompositeLocation newCalleeCompLoc =
+ translateCompositeLocationToCallee(callerCompLoc, baseLocTuple, mdCallee);
+
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(calleeParamLocTuple.get(0),
+ newCalleeCompLoc);
+
+ // System.out.println("---------key=" + calleeParamLocTuple.get(0) + " callerCompLoc="
+ // + callerCompLoc + " newCalleeCompLoc=" + newCalleeCompLoc);
+
+ } else if (refParamIdx != -1) {
+ // the first element of an argument composite location matches with one of paramtere
+ // composite locations
+
+ // System.out.println("-------param match case=");
+
+ NTuple<Descriptor> argTupleRef = mapIdxToArgTuple.get(refParamIdx);
+ FlowNode refParamFlowNode = calleeFlowGraph.getParamFlowNode(refParamIdx);
+ NTuple<Location> refParamLocTuple =
+ translateToLocTuple(mdCallee, refParamFlowNode.getDescTuple());
+
+ // System.out.println("---------refParamLocTuple=" + refParamLocTuple
+ // + " from argTupleRef=" + argTupleRef);
+
+ CompositeLocation newCalleeCompLoc = new CompositeLocation();
+ for (int i = 0; i < refParamLocTuple.size(); i++) {
+ newCalleeCompLoc.addLocation(refParamLocTuple.get(i));
+ }
+ for (int i = argTupleRef.size(); i < callerCompLoc.getSize(); i++) {
+ newCalleeCompLoc.addLocation(callerCompLoc.get(i));
+ }
+
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(calleeParamLocTuple.get(0),
+ newCalleeCompLoc);
+
+ calleeParamFlowNode.setCompositeLocation(newCalleeCompLoc);
+ // System.out.println("-----------key=" + calleeParamLocTuple.get(0) +
+ // " callerCompLoc="
+ // + callerCompLoc + " newCalleeCompLoc=" + newCalleeCompLoc);
+
+ } else {
+ CompositeLocation newCalleeCompLoc =
+ calculateCompositeLocationFromSubGlobalGraph(mdCallee, calleeParamFlowNode);
+ if (newCalleeCompLoc != null) {
+ calleeGlobalGraph.addMapLocationToInferCompositeLocation(calleeParamLocTuple.get(0),
+ newCalleeCompLoc);
+ calleeParamFlowNode.setCompositeLocation(newCalleeCompLoc);
+ }
+ }
+
+ // System.out.println("-----------------calleeParamFlowNode="
+ // + calleeParamFlowNode.getCompositeLocation());
+
+ // }
+
+ }
+ }
+
+ }
+
+ }
+
+ private CompositeLocation calculateCompositeLocationFromSubGlobalGraph(MethodDescriptor md,
+ FlowNode paramNode) {
+
+ // System.out.println("#############################################################");
+ // System.out.println("calculateCompositeLocationFromSubGlobalGraph=" + paramNode);
+
+ GlobalFlowGraph subGlobalFlowGraph = getSubGlobalFlowGraph(md);
+ NTuple<Location> paramLocTuple = translateToLocTuple(md, paramNode.getDescTuple());
+ GlobalFlowNode paramGlobalNode = subGlobalFlowGraph.getFlowNode(paramLocTuple);
+
+ List<NTuple<Location>> prefixList = calculatePrefixList(subGlobalFlowGraph, paramGlobalNode);
+
+ Location prefixLoc = paramLocTuple.get(0);
+
+ Set<GlobalFlowNode> reachableNodeSet =
+ subGlobalFlowGraph.getReachableNodeSetByPrefix(paramGlobalNode.getLocTuple().get(0));
+ // Set<GlobalFlowNode> reachNodeSet = globalFlowGraph.getReachableNodeSetFrom(node);
+
+ // System.out.println("node=" + node + " prefixList=" + prefixList);
+
+ for (int i = 0; i < prefixList.size(); i++) {
+ NTuple<Location> curPrefix = prefixList.get(i);
+ Set<NTuple<Location>> reachableCommonPrefixSet = new HashSet<NTuple<Location>>();
+
+ for (Iterator iterator2 = reachableNodeSet.iterator(); iterator2.hasNext();) {
+ GlobalFlowNode reachNode = (GlobalFlowNode) iterator2.next();
+ if (reachNode.getLocTuple().startsWith(curPrefix)) {
+ reachableCommonPrefixSet.add(reachNode.getLocTuple());
+ }
+ }
+ // System.out.println("reachableCommonPrefixSet=" + reachableCommonPrefixSet);
+
+ if (!reachableCommonPrefixSet.isEmpty()) {
+
+ MethodDescriptor curPrefixFirstElementMethodDesc =
+ (MethodDescriptor) curPrefix.get(0).getDescriptor();
+
+ MethodDescriptor nodePrefixLocFirstElementMethodDesc =
+ (MethodDescriptor) prefixLoc.getDescriptor();
+
+ // System.out.println("curPrefixFirstElementMethodDesc=" +
+ // curPrefixFirstElementMethodDesc);
+ // System.out.println("nodePrefixLocFirstElementMethodDesc="
+ // + nodePrefixLocFirstElementMethodDesc);
+
+ if (curPrefixFirstElementMethodDesc.equals(nodePrefixLocFirstElementMethodDesc)
+ || isTransitivelyCalledFrom(nodePrefixLocFirstElementMethodDesc,
+ curPrefixFirstElementMethodDesc)) {
+
+ // TODO
+ // if (!node.getLocTuple().startsWith(curPrefix.get(0))) {
+
+ Location curPrefixLocalLoc = curPrefix.get(0);
+ if (subGlobalFlowGraph.mapLocationToInferCompositeLocation.containsKey(curPrefixLocalLoc)) {
+ // in this case, the local variable of the current prefix has already got a composite
+ // location
+ // so we just ignore the current composite location.
+
+ // System.out.println("HERE WE DO NOT ASSIGN A COMPOSITE LOCATION TO =" + node
+ // + " DUE TO " + curPrefix);
+ return null;
+ }
+
+ if (!needToGenerateCompositeLocation(paramGlobalNode, curPrefix)) {
+ // System.out.println("NO NEED TO GENERATE COMP LOC to " + paramGlobalNode
+ // + " with prefix=" + curPrefix);
+ return null;
+ }
+
+ Location targetLocalLoc = paramGlobalNode.getLocTuple().get(0);
+ CompositeLocation newCompLoc = generateCompositeLocation(curPrefix);
+ // System.out.println("NEED TO ASSIGN COMP LOC TO " + paramGlobalNode + " with prefix="
+ // + curPrefix);
+ // System.out.println("-targetLocalLoc=" + targetLocalLoc + " - newCompLoc=" +
+ // newCompLoc);
+
+ // makes sure that a newly generated location appears in the hierarchy graph
+ for (int compIdx = 0; compIdx < newCompLoc.getSize(); compIdx++) {
+ Location curLoc = newCompLoc.get(compIdx);
+ getHierarchyGraph(curLoc.getDescriptor()).getHNode(curLoc.getLocDescriptor());
+ }
+
+ subGlobalFlowGraph.addMapLocationToInferCompositeLocation(targetLocalLoc, newCompLoc);
+
+ return newCompLoc;
+
+ }
+
+ }
+
+ }
+ return null;
+ }
+
+ private int getParamIdx(CompositeLocation compLoc,
+ Map<Integer, NTuple<Descriptor>> mapIdxToArgTuple) {
+
+ // if the composite location is started with the argument descriptor
+ // return the argument's index. o.t. return -1
+
+ Set<Integer> keySet = mapIdxToArgTuple.keySet();
+ for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
+ Integer key = (Integer) iterator.next();
+ NTuple<Descriptor> argTuple = mapIdxToArgTuple.get(key);
+ if (argTuple.size() > 0 && translateToDescTuple(compLoc.getTuple()).startsWith(argTuple)) {
+ // System.out.println("compLoc.getTuple=" + compLoc + " is started with " + argTuple);
+ return key.intValue();
+ }
+ }
+
+ return -1;
+ }
+
+ private boolean isPrimitiveType(NTuple<Descriptor> argTuple) {
+
+ Descriptor lastDesc = argTuple.get(argTuple.size() - 1);
+
+ if (lastDesc instanceof FieldDescriptor) {
+ return ((FieldDescriptor) lastDesc).getType().isPrimitive();
+ } else if (lastDesc instanceof VarDescriptor) {
+ return ((VarDescriptor) lastDesc).getType().isPrimitive();
+ } else if (lastDesc instanceof InterDescriptor) {
+ return true;
+ }
+
+ return false;
+ }
+
+ private CompositeLocation translateCompositeLocationToCallee(CompositeLocation callerCompLoc,
+ NTuple<Location> baseLocTuple, MethodDescriptor mdCallee) {
+
+ CompositeLocation newCalleeCompLoc = new CompositeLocation();
+
+ Location calleeThisLoc = new Location(mdCallee, mdCallee.getThis());
+ newCalleeCompLoc.addLocation(calleeThisLoc);
+
+ // remove the base tuple from the caller
+ // ex; In the method invoation foo.bar.methodA(), the callee will have the composite location
+ // ,which is relative to the 'this' variable, <THIS,...>
+ for (int i = baseLocTuple.size(); i < callerCompLoc.getSize(); i++) {
+ newCalleeCompLoc.addLocation(callerCompLoc.get(i));
+ }
+
+ return newCalleeCompLoc;
+
+ }
+
+ private void calculateGlobalValueFlowCompositeLocation() {
+
+ System.out.println("SSJAVA: Calculate composite locations in the global value flow graph");
+ MethodDescriptor methodDescEventLoop = ssjava.getMethodContainingSSJavaLoop();
+ GlobalFlowGraph globalFlowGraph = getSubGlobalFlowGraph(methodDescEventLoop);
+
+ Set<Location> calculatedPrefixSet = new HashSet<Location>();
+
+ Set<GlobalFlowNode> nodeSet = globalFlowGraph.getNodeSet();
+
+ next: for (Iterator iterator = nodeSet.iterator(); iterator.hasNext();) {
+ GlobalFlowNode node = (GlobalFlowNode) iterator.next();
+
+ Location prefixLoc = node.getLocTuple().get(0);
+
+ if (calculatedPrefixSet.contains(prefixLoc)) {
+ // the prefix loc has been already assigned to a composite location
+ continue;
+ }
+
+ calculatedPrefixSet.add(prefixLoc);
+
+ // Set<GlobalFlowNode> incomingNodeSet = globalFlowGraph.getIncomingNodeSet(node);
+ List<NTuple<Location>> prefixList = calculatePrefixList(globalFlowGraph, node);
+
+ Set<GlobalFlowNode> reachableNodeSet =
+ globalFlowGraph.getReachableNodeSetByPrefix(node.getLocTuple().get(0));
+ // Set<GlobalFlowNode> reachNodeSet = globalFlowGraph.getReachableNodeSetFrom(node);
+
+ // System.out.println("node=" + node + " prefixList=" + prefixList);
+ // System.out.println("---prefixList=" + prefixList);
+
+ nextprefix: for (int i = 0; i < prefixList.size(); i++) {
+ NTuple<Location> curPrefix = prefixList.get(i);
+ // System.out.println("---curPrefix=" + curPrefix);
+ Set<NTuple<Location>> reachableCommonPrefixSet = new HashSet<NTuple<Location>>();
+
+ for (Iterator iterator2 = reachableNodeSet.iterator(); iterator2.hasNext();) {
+ GlobalFlowNode reachNode = (GlobalFlowNode) iterator2.next();
+ if (reachNode.getLocTuple().startsWith(curPrefix)) {
+ reachableCommonPrefixSet.add(reachNode.getLocTuple());
+ }
+ }
+ // System.out.println("reachableCommonPrefixSet=" + reachableCommonPrefixSet);
+
+ if (!reachableCommonPrefixSet.isEmpty()) {
+
+ MethodDescriptor curPrefixFirstElementMethodDesc =
+ (MethodDescriptor) curPrefix.get(0).getDescriptor();
+
+ MethodDescriptor nodePrefixLocFirstElementMethodDesc =
+ (MethodDescriptor) prefixLoc.getDescriptor();
+
+ // System.out.println("curPrefixFirstElementMethodDesc=" +
+ // curPrefixFirstElementMethodDesc);
+ // System.out.println("nodePrefixLocFirstElementMethodDesc="
+ // + nodePrefixLocFirstElementMethodDesc);
+
+ if (curPrefixFirstElementMethodDesc.equals(nodePrefixLocFirstElementMethodDesc)
+ || isTransitivelyCalledFrom(nodePrefixLocFirstElementMethodDesc,
+ curPrefixFirstElementMethodDesc)) {
+
+ // TODO
+ // if (!node.getLocTuple().startsWith(curPrefix.get(0))) {
+
+ Location curPrefixLocalLoc = curPrefix.get(0);
+ if (globalFlowGraph.mapLocationToInferCompositeLocation.containsKey(curPrefixLocalLoc)) {
+ // in this case, the local variable of the current prefix has already got a composite
+ // location
+ // so we just ignore the current composite location.
+
+ // System.out.println("HERE WE DO NOT ASSIGN A COMPOSITE LOCATION TO =" + node
+ // + " DUE TO " + curPrefix);
+
+ continue next;
+ }
+
+ if (!needToGenerateCompositeLocation(node, curPrefix)) {
+ // System.out.println("NO NEED TO GENERATE COMP LOC to " + node + " with prefix="
+ // + curPrefix);
+ // System.out.println("prefixList=" + prefixList);
+ // System.out.println("reachableNodeSet=" + reachableNodeSet);
+ continue nextprefix;
+ }
+
+ Location targetLocalLoc = node.getLocTuple().get(0);
+ CompositeLocation newCompLoc = generateCompositeLocation(curPrefix);
+ // System.out.println("NEED TO ASSIGN COMP LOC TO " + node + " with prefix=" +
+ // curPrefix);
+ // System.out.println("-targetLocalLoc=" + targetLocalLoc + " - newCompLoc="
+ // + newCompLoc);
+ globalFlowGraph.addMapLocationToInferCompositeLocation(targetLocalLoc, newCompLoc);
+ // }
+
+ // if (node.getLocTuple().get(0).getDescriptor().getSymbol().equals("get_scale_factors")
+ // || node.getLocTuple().get(0).getDescriptor().getSymbol()
+ // .equals("get_LSF_scale_data")){
+ // Set<GlobalFlowNode> debugInNodeSet =
+ // globalFlowGraph.debug_getIncomingNodeSetFromPrefix(node, curPrefix);
+ // }
+ continue next;
+ // }
+
+ }
+
+ }
+
+ }
+
+ }
+ }
+
+ private boolean checkFlowNodeReturnThisField(MethodDescriptor md) {