From: yeom Date: Fri, 7 Dec 2012 02:48:24 +0000 (+0000) Subject: changes. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=ce5159c8570f28f7b37e2a19c6c62d01c501b2c2 changes. --- diff --git a/Robust/src/Analysis/SSJava/FlowEdge.java b/Robust/src/Analysis/SSJava/FlowEdge.java index 5309bac3..121f07d0 100644 --- a/Robust/src/Analysis/SSJava/FlowEdge.java +++ b/Robust/src/Analysis/SSJava/FlowEdge.java @@ -49,6 +49,10 @@ public class FlowEdge { this.initTuple = initTuple; } + public void setEndTuple(NTuple endTuple) { + this.endTuple = endTuple; + } + public int hashCode() { return src.hashCode() + dst.hashCode() + initTuple.hashCode() + endTuple.hashCode(); } diff --git a/Robust/src/Analysis/SSJava/FlowGraph.java b/Robust/src/Analysis/SSJava/FlowGraph.java index 2031460d..2e57d668 100644 --- a/Robust/src/Analysis/SSJava/FlowGraph.java +++ b/Robust/src/Analysis/SSJava/FlowGraph.java @@ -194,7 +194,6 @@ public class FlowGraph { public Set getNodeSet() { Set set = new HashSet(); set.addAll(mapDescTupleToInferNode.values()); - System.out.println("NODESET=" + set); return set; } @@ -876,6 +875,29 @@ public class FlowGraph { } + public void updateTuple(FlowNode node, NTuple newTuple) { + + NTuple curTuple = node.getCurrentDescTuple(); + Set inEdgeSet = getInEdgeSet(node); + for (Iterator iterator = inEdgeSet.iterator(); iterator.hasNext();) { + FlowEdge flowEdge = (FlowEdge) iterator.next(); + if (flowEdge.getEndTuple().equals(curTuple)) { + flowEdge.setEndTuple(newTuple); + } + } + + Set outEdgeSet = getOutEdgeSet(node); + for (Iterator iterator = outEdgeSet.iterator(); iterator.hasNext();) { + FlowEdge flowEdge = (FlowEdge) iterator.next(); + if (flowEdge.getInitTuple().equals(curTuple)) { + flowEdge.setInitTuple(newTuple); + } + } + + node.setBaseTuple(newTuple); + + } + public void removeNode(FlowNode node) { NTuple tuple = node.getCurrentDescTuple(); diff --git a/Robust/src/Analysis/SSJava/HierarchyGraph.java b/Robust/src/Analysis/SSJava/HierarchyGraph.java index e701c3ed..c6cde611 100644 --- a/Robust/src/Analysis/SSJava/HierarchyGraph.java +++ b/Robust/src/Analysis/SSJava/HierarchyGraph.java @@ -1218,7 +1218,6 @@ public class HierarchyGraph { public void writeGraph(boolean isSimple) { String graphName = "hierarchy" + name; - System.out.println("#GRAPHNAME=" + graphName); graphName = graphName.replaceAll("[\\W]", ""); if (isSimple) { diff --git a/Robust/src/Analysis/SSJava/LocationInference.java b/Robust/src/Analysis/SSJava/LocationInference.java index 3224bbe4..20a2fa5d 100644 --- a/Robust/src/Analysis/SSJava/LocationInference.java +++ b/Robust/src/Analysis/SSJava/LocationInference.java @@ -141,6 +141,8 @@ public class LocationInference { private Map>> mapHighestOverriddenMethodDescToSetLowerThanPCLoc; + private Map>> mapHighestOverriddenMethodDescToSetHigherThanRETURNLoc; + public static final String GLOBALLOC = "GLOBALLOC"; public static final String INTERLOC = "INTERLOC"; @@ -243,6 +245,9 @@ public class LocationInference { mapHighestOverriddenMethodDescToPCLocTuple = new HashMap>(); + mapHighestOverriddenMethodDescToSetHigherThanRETURNLoc = + new HashMap>>(); + this.buildLattice = new BuildLattice(this); } @@ -307,6 +312,8 @@ public class LocationInference { buildInheritanceTree(); calculateReturnPCLocInheritance(); +// System.exit(0); + constructHierarchyGraph(); addInheritanceConstraintsToHierarchyGraph(); @@ -364,6 +371,7 @@ public class LocationInference { } private void updateFlowGraphPCReturnLocInheritance() { + Set keySet = mapHighestOverriddenMethodDescToMethodDescSet.keySet(); for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { MethodDescriptor highestMethodDesc = (MethodDescriptor) iterator.next(); @@ -375,13 +383,15 @@ public class LocationInference { Set methodDescSet = mapHighestOverriddenMethodDescToMethodDescSet.get(highestMethodDesc); - NTuple highestPCLoc = + NTuple highestPCLocDescTuple = mapHighestOverriddenMethodDescToPCLocTuple.get(highestMethodDesc); - NTuple highestRETURNLoc = + NTuple highestRETURNLocDescTuple = mapHighestOverriddenMethodDescToReturnLocTuple.get(highestMethodDesc); - System.out.println("---highestMethodDesc=" + highestMethodDesc); + System.out.println("---updateFlowGraphPCReturnLocInheritance=" + highestMethodDesc); + System.out.println("-----highestPCLoc=" + highestPCLocDescTuple); + System.out.println("-----highestRETURNLoc=" + highestRETURNLocDescTuple); for (Iterator iterator2 = methodDescSet.iterator(); iterator2.hasNext();) { MethodDescriptor md = (MethodDescriptor) iterator2.next(); @@ -389,60 +399,91 @@ public class LocationInference { MethodSummary summary = getMethodSummary(md); CompositeLocation curPCLoc = summary.getPCLoc(); - - // update PCLOC - if (highestPCLoc != null) { - // handle the case that PCLOC is started with 'this'... - NTuple newPCLoc = new NTuple(); - if (highestPCLoc.size() == 1) { - newPCLoc.add(highestPCLoc.get(0)); - } else { - newPCLoc.add(md.getThis()); - newPCLoc.add(highestPCLoc.get(1)); + NTuple curPCDescTuple = translateToDescTuple(curPCLoc.getTuple()); + System.out.println("md=" + md + " curPCLoc=" + curPCLoc); + System.out.println("highestPCLoc=" + highestPCLocDescTuple); + + if (highestPCLocDescTuple == null) { + // this case: PCLOC is top + System.out.println("###SET PCLOC AS TOP"); + if (curPCDescTuple != null && !curPCLoc.get(0).isTop()) { + FlowNode pcFlowNode = flowGraph.getFlowNode(curPCDescTuple); + flowGraph.removeNode(pcFlowNode); } - - FlowNode pcFlowNode = flowGraph.getFlowNode(translateToDescTuple(curPCLoc.getTuple())); - pcFlowNode.setBaseTuple(newPCLoc); - - CompositeLocation newPCLocCompLoc = - new CompositeLocation(translateToLocTuple(md, newPCLoc)); - summary.setPCLoc(newPCLocCompLoc); + summary.setPCLoc(new CompositeLocation(new Location(md, Location.TOP))); } else { - // need to remove PCLOC if the overridden method defines it - if (curPCLoc != null && !curPCLoc.get(0).isTop()) { - System.out.println("md=" + md + " curPCLoc=" + curPCLoc); - FlowNode pcFlowNode = flowGraph.getFlowNode(translateToDescTuple(curPCLoc.getTuple())); - System.out.println("#######REMOVE PCLOCNODE=" + pcFlowNode); - flowGraph.removeNode(pcFlowNode); + NTuple newPCDescTuple = new NTuple(); + if (highestPCLocDescTuple.size() == 1) { + newPCDescTuple.add(highestPCLocDescTuple.get(0)); + } else { + newPCDescTuple.add(md.getThis()); + newPCDescTuple.add(highestPCLocDescTuple.get(1)); + } + if (!curPCDescTuple.equals(newPCDescTuple)) { + FlowNode pcFlowNode = flowGraph.getFlowNode(curPCDescTuple); + flowGraph.updateTuple(pcFlowNode, newPCDescTuple); + // flowGraph.removeNode(pcFlowNode); + System.out.println("####UPDATE PCLOC=" + newPCDescTuple); + Set> descSetLowerThanPCLoc = + mapHighestOverriddenMethodDescToSetLowerThanPCLoc.get(highestMethodDesc); + System.out.println("####descSetLowerThanPCLoc=" + descSetLowerThanPCLoc); + for (Iterator iterator3 = descSetLowerThanPCLoc.iterator(); iterator3.hasNext();) { + NTuple lowerNTuple = (NTuple) iterator3.next(); + flowGraph.addValueFlowEdge(newPCDescTuple, lowerNTuple); + } + CompositeLocation newPCCompLoc = + new CompositeLocation(translateToLocTuple(md, newPCDescTuple)); + summary.setPCLoc(newPCCompLoc); + } else { + System.out.println("####DO NOTHING!:)"); } - } - // need to update RETURNLOC - if (highestRETURNLoc != null) { + } + // update return loc + if (highestRETURNLocDescTuple != null) { CompositeLocation curRETURNLoc = summary.getRETURNLoc(); + NTuple curReturnDescTuple = translateToDescTuple(curRETURNLoc.getTuple()); System.out.println("curRETURNLoc=" + curRETURNLoc); - // handle the case that RETURNLOC is started with 'this'... - NTuple newRETURNLoc = new NTuple(); - if (highestRETURNLoc.size() == 1) { - newRETURNLoc.add(highestRETURNLoc.get(0)); - } else { - newRETURNLoc.add(md.getThis()); - newRETURNLoc.add(highestRETURNLoc.get(1)); - } + if (!curReturnDescTuple.equals(highestRETURNLocDescTuple)) { + // handle the case that RETURNLOC is started with 'this'... + NTuple newRETURNLocDescTuple = new NTuple(); + if (highestRETURNLocDescTuple.size() == 1) { + newRETURNLocDescTuple.add(highestRETURNLocDescTuple.get(0)); + } else { + newRETURNLocDescTuple.add(md.getThis()); + newRETURNLocDescTuple.add(highestRETURNLocDescTuple.get(1)); + } - FlowNode returnFlowNode = - flowGraph.getFlowNode(translateToDescTuple(curRETURNLoc.getTuple())); - returnFlowNode.setBaseTuple(newRETURNLoc); + FlowNode returnFlowNode = flowGraph.getFlowNode(curReturnDescTuple); + System.out.println("####UPDATE RETURNLOC=" + newRETURNLocDescTuple); + flowGraph.updateTuple(returnFlowNode, newRETURNLocDescTuple); - CompositeLocation newRETURNLocCompLoc = - new CompositeLocation(translateToLocTuple(md, newRETURNLoc)); - summary.setPCLoc(newRETURNLocCompLoc); - System.out.println("md=" + md + "###newRETURNLocCompLoc=" + newRETURNLocCompLoc); + Set> descSetHigherThanRETURNLoc = + mapHighestOverriddenMethodDescToSetHigherThanRETURNLoc.get(highestMethodDesc); + System.out.println("####descSetLowerThanPCLoc=" + descSetHigherThanRETURNLoc); + for (Iterator iterator3 = descSetHigherThanRETURNLoc.iterator(); iterator3.hasNext();) { + NTuple higherNTuple = (NTuple) iterator3.next(); + flowGraph.addValueFlowEdge(higherNTuple, newRETURNLocDescTuple); + } + CompositeLocation newRETURNLocCompLoc = + new CompositeLocation(translateToLocTuple(md, newRETURNLocDescTuple)); + summary.setPCLoc(newRETURNLocCompLoc); + System.out.println("md=" + md + "###newRETURNLocCompLoc=" + newRETURNLocCompLoc); + } else { + System.out.println("####DO NOTHING!:)"); + } } + +// try { +// flowGraph.writeGraph("2"); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } } } } @@ -450,6 +491,10 @@ public class LocationInference { private void calculateHighestPCLocInheritance() { Set keySet = mapHighestOverriddenMethodDescToMethodDescSet.keySet(); + + Map mapMethodDescToParamCount = + new HashMap(); + next: for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { MethodDescriptor highestMethodDesc = (MethodDescriptor) iterator.next(); @@ -460,6 +505,12 @@ public class LocationInference { Set methodDescSet = mapHighestOverriddenMethodDescToMethodDescSet.get(highestMethodDesc); + if (methodDescSet.size() > 1) { + System.out.println("---method desc set=" + methodDescSet + " from=" + highestMethodDesc); + } else { + continue next; + } + for (Iterator iterator2 = methodDescSet.iterator(); iterator2.hasNext();) { MethodDescriptor md = (MethodDescriptor) iterator2.next(); @@ -471,66 +522,104 @@ public class LocationInference { System.out.println("###md=" + md + " paramNodeSet=" + paramNodeSet); CompositeLocation pcLOC = getMethodSummary(md).getPCLoc(); + System.out.println("---pcLOC=" + pcLOC); + + if (md.equals(highestMethodDesc)) { + mapHighestOverriddenMethodDescToPCLocTuple.put(highestMethodDesc, + translateToDescTuple(pcLOC.getTuple())); + } if (!pcLOC.get(0).isTop()) { - if (pcLOC.getSize() == 1) { - // return location is not started with 'this' - // check whether the return location is lower than all parameters. - - FlowNode pcFlowNode = flowGraph.getFlowNode(translateToDescTuple(pcLOC.getTuple())); - - int count = 0; - for (Iterator iterator3 = paramNodeSet.iterator(); iterator3.hasNext();) { - FlowNode paramNode = (FlowNode) iterator3.next(); - if (flowGraph.getReachableSetFrom(pcFlowNode.getCurrentDescTuple().subList(0, 1)) - .contains(paramNode)) { - count++; - System.out.println("-------" + pcFlowNode + " -> " + paramNode); - } - } - int offset = 0; - if (!md.isStatic()) { - offset = 1; - } + FlowNode pcFlowNode = flowGraph.getFlowNode(translateToDescTuple(pcLOC.getTuple())); - NTuple rTuple = new NTuple(); - rTuple.add(pcLOC.get(0).getLocDescriptor()); - if (count == (md.numParameters() + offset)) { - // means return loc is lower than a composite location starting with 'this' - mapHighestOverriddenMethodDescToPCLocTuple.put(highestMethodDesc, rTuple); - } else { - if (tempTuple == null) { - tempTuple = rTuple; - } - } - } else { - // if the current overridden method has a composite pc loc(size>1) - // and it has not yet finalized the pc location, - // the highest overridden method would have the composite pc location starting with - // 'this' - NTuple rTuple = new NTuple(); - for (int i = 0; i < pcLOC.getSize(); i++) { - rTuple.add(pcLOC.get(i).getLocDescriptor()); + int count = 0; + for (Iterator iterator3 = paramNodeSet.iterator(); iterator3.hasNext();) { + FlowNode paramNode = (FlowNode) iterator3.next(); + if (flowGraph.getReachableSetFrom(pcFlowNode.getCurrentDescTuple().subList(0, 1)) + .contains(paramNode)) { + count++; + System.out.println("-------" + pcFlowNode + " -> " + paramNode); } - tempTuple = rTuple; } + System.out.println("$$$ pcLOC=" + pcLOC + " count higher=" + count); + mapMethodDescToParamCount.put(md, count); + } else { + + // the PC location is top + // if one of pcloc among the method inheritance chain has the TOP, + // all methods in the same chain should have the TOP. mapHighestOverriddenMethodDescToPCLocTuple.remove(highestMethodDesc); - System.out.println("highest=" + highestMethodDesc + " HIGHEST PCLOC=" - + mapHighestOverriddenMethodDescToPCLocTuple.get(highestMethodDesc)); + // System.out.println("highest=" + highestMethodDesc + " HIGHEST PCLOC=" + // + mapHighestOverriddenMethodDescToPCLocTuple.get(highestMethodDesc)); + + Set> descTupleSetLowerThanPC = new HashSet>(); + for (Iterator iterator3 = paramNodeSet.iterator(); iterator3.hasNext();) { + FlowNode flowNode = (FlowNode) iterator3.next(); + descTupleSetLowerThanPC.add(flowNode.getCurrentDescTuple()); + } + System.out.println("###TOP CASE"); + System.out.println("descTupleSetLowerThanPC=" + descTupleSetLowerThanPC); + mapHighestOverriddenMethodDescToSetLowerThanPCLoc.put(highestMethodDesc, + descTupleSetLowerThanPC); + continue next; } } - } + System.out.println("#INDENTIFY WHICH METHOD..."); + // identify which method in the inheritance chain has the highest PCLOC + // basically, finds a method that has the highest count or TOP location + int highestCount = -1; + MethodDescriptor methodDescHighestCount = null; + for (Iterator iterator2 = methodDescSet.iterator(); iterator2.hasNext();) { + MethodDescriptor methodDesc = (MethodDescriptor) iterator2.next(); + if (mapMethodDescToParamCount.containsKey(methodDesc)) { + int curCount = mapMethodDescToParamCount.get(methodDesc).intValue(); + if (highestCount < curCount) { + highestCount = curCount; + methodDescHighestCount = methodDesc; + } + } + } + + if (methodDescHighestCount != null) { + FlowGraph flowGraph = getFlowGraph(methodDescHighestCount); + CompositeLocation pcLOC = getMethodSummary(methodDescHighestCount).getPCLoc(); + FlowNode pcFlowNode = flowGraph.getFlowNode(translateToDescTuple(pcLOC.getTuple())); + Set reachableSet = + flowGraph.getReachableSetFrom(pcFlowNode.getCurrentDescTuple().subList(0, 1)); + + Set reachableParamNodeSet = new HashSet(); + for (Iterator iterator3 = reachableSet.iterator(); iterator3.hasNext();) { + FlowNode flowNode = (FlowNode) iterator3.next(); + if (flowGraph.isParameter(flowNode.getCurrentDescTuple())) { + reachableParamNodeSet.add(flowNode); + } + + System.out.println(flowNode + " is PARAM=" + + flowGraph.isParameter(flowNode.getCurrentDescTuple())); + } + + Set> descTupleSetLowerThanPC = new HashSet>(); + for (Iterator iterator2 = reachableParamNodeSet.iterator(); iterator2.hasNext();) { + FlowNode flowNode = (FlowNode) iterator2.next(); + descTupleSetLowerThanPC.add(flowNode.getCurrentDescTuple()); + } + + // mapHighestOverriddenMethodDescToPCLocTuple.remove(highestMethodDesc); + mapHighestOverriddenMethodDescToSetLowerThanPCLoc.put(highestMethodDesc, + descTupleSetLowerThanPC); + } - if (!mapHighestOverriddenMethodDescToPCLocTuple.containsKey(highestMethodDesc) - && tempTuple != null) { - mapHighestOverriddenMethodDescToPCLocTuple.put(highestMethodDesc, tempTuple); } - System.out.println("highest=" + highestMethodDesc + " HIGHEST PCLOC=" + + System.out.println("####################################"); + System.out.println(" highest=" + highestMethodDesc + " HIGHEST PCLOC=" + mapHighestOverriddenMethodDescToPCLocTuple.get(highestMethodDesc)); + System.out.println(" setLowerThanPCLoc=" + + mapHighestOverriddenMethodDescToSetLowerThanPCLoc.get(highestMethodDesc)); } } @@ -538,76 +627,91 @@ public class LocationInference { private void calculateLowestReturnLocInheritance() { Set keySet = mapHighestOverriddenMethodDescToMethodDescSet.keySet(); + + Map mapMethodDescToParamCount = + new HashMap(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { MethodDescriptor highestMethodDesc = (MethodDescriptor) iterator.next(); NTuple tempTuple = null; if (getMethodSummary(highestMethodDesc).getRETURNLoc() != null) { + + System.out.println("---calculateLowestReturnLocInheritance=" + highestMethodDesc); + Set methodDescSet = mapHighestOverriddenMethodDescToMethodDescSet.get(highestMethodDesc); + for (Iterator iterator2 = methodDescSet.iterator(); iterator2.hasNext();) { MethodDescriptor md = (MethodDescriptor) iterator2.next(); FlowGraph flowGraph = getFlowGraph(md); Set paramNodeSet = flowGraph.getParamFlowNodeSet(); - System.out.println("###md=" + md + " paramNodeSet=" + paramNodeSet); + System.out.println("###md=" + md + " paramNodeSet=" + paramNodeSet + " returnLoc=" + + getMethodSummary(md).getRETURNLoc()); CompositeLocation returnLoc = getMethodSummary(md).getRETURNLoc(); - if (returnLoc.getSize() == 1) { - // return location is not started with 'this' - // check whether the return location is lower than all parameters. - FlowNode returnFlowNode = - flowGraph.getFlowNode(translateToDescTuple(returnLoc.getTuple())); - - int count = 0; - for (Iterator iterator3 = paramNodeSet.iterator(); iterator3.hasNext();) { - FlowNode paramNode = (FlowNode) iterator3.next(); - if (flowGraph.getReachableSetFrom(paramNode.getCurrentDescTuple().subList(0, 1)) - .contains(returnFlowNode)) { - count++; - System.out.println("-------" + paramNode + " -> " + returnFlowNode); - } + FlowNode returnFlowNode = + flowGraph.getFlowNode(translateToDescTuple(returnLoc.getTuple())); + + int count = 0; + for (Iterator iterator3 = paramNodeSet.iterator(); iterator3.hasNext();) { + FlowNode paramNode = (FlowNode) iterator3.next(); + if (flowGraph.getReachableSetFrom(paramNode.getCurrentDescTuple().subList(0, 1)) + .contains(returnFlowNode)) { + count++; } + } + mapMethodDescToParamCount.put(md, count); + System.out.println("###returnLoc=" + returnLoc + " count higher=" + count); + } - int offset = 0; - if (!md.isStatic()) { - offset = 1; - } + System.out.println("#INDENTIFY WHICH METHOD..."); + // identify which method in the inheritance chain has the highest PCLOC + // basically, finds a method that has the highest count or TOP location + int highestCount = -1; + MethodDescriptor methodDescHighestCount = null; + for (Iterator iterator2 = methodDescSet.iterator(); iterator2.hasNext();) { + MethodDescriptor methodDesc = (MethodDescriptor) iterator2.next(); + int curCount = mapMethodDescToParamCount.get(methodDesc).intValue(); + if (highestCount < curCount) { + highestCount = curCount; + methodDescHighestCount = methodDesc; + } + } - NTuple rTuple = new NTuple(); - rTuple.add(returnLoc.get(0).getLocDescriptor()); - if (count == (md.numParameters() + offset)) { - // means return loc is lower than a composite location starting with 'this' - mapHighestOverriddenMethodDescToReturnLocTuple.put(highestMethodDesc, rTuple); - } else { - if (tempTuple == null) { - tempTuple = rTuple; - } + if (methodDescHighestCount != null) { + FlowGraph flowGraph = getFlowGraph(methodDescHighestCount); + CompositeLocation returnLOC = getMethodSummary(methodDescHighestCount).getRETURNLoc(); + NTuple returnLocTuple = translateToDescTuple(returnLOC.getTuple()); + FlowNode returnFlowNode = flowGraph.getFlowNode(returnLocTuple); + + Set curMethodParamNodeSet = flowGraph.getParamFlowNodeSet(); + Set> descTupleSetHigherThanPC = new HashSet>(); + for (Iterator iterator3 = curMethodParamNodeSet.iterator(); iterator3.hasNext();) { + FlowNode paramNode = (FlowNode) iterator3.next(); + if (flowGraph.getReachableSetFrom(paramNode.getCurrentDescTuple().subList(0, 1)) + .contains(returnFlowNode)) { + descTupleSetHigherThanPC.add(paramNode.getCurrentDescTuple()); } - } else { - // if the current overridden method has a composite return loc(size>1) - // and it has not yet finalized the return location - // the highest overridden method has the composite return location starting with - // 'this' - NTuple rTuple = new NTuple(); - for (int i = 0; i < returnLoc.getSize(); i++) { - rTuple.add(returnLoc.get(i).getLocDescriptor()); - } - tempTuple = rTuple; } + mapHighestOverriddenMethodDescToReturnLocTuple.put(highestMethodDesc, returnLocTuple); + mapHighestOverriddenMethodDescToSetHigherThanRETURNLoc.put(highestMethodDesc, + descTupleSetHigherThanPC); + } - } + System.out.println("####################################"); + System.out.println(" highest=" + highestMethodDesc + " LOWEST RETURNLOC=" + + mapHighestOverriddenMethodDescToReturnLocTuple.get(highestMethodDesc)); + System.out.println(" setHigherThanReturnLoc=" + + mapHighestOverriddenMethodDescToSetHigherThanRETURNLoc.get(highestMethodDesc)); - if (!mapHighestOverriddenMethodDescToReturnLocTuple.containsKey(highestMethodDesc) - && tempTuple != null) { - mapHighestOverriddenMethodDescToReturnLocTuple.put(highestMethodDesc, tempTuple); } - System.out.println("highest=" + highestMethodDesc + " rTuple=" - + mapHighestOverriddenMethodDescToReturnLocTuple.get(highestMethodDesc)); + } } @@ -690,6 +794,12 @@ public class LocationInference { HierarchyGraph parentGraph = getHierarchyGraph(parentClassDescriptor); HierarchyGraph childGraph = getHierarchyGraph(childClassDescriptor); + Set 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> parentMergeNodeMap = parentGraph.getMapHNodetoMergeSet(); Map> childMergeNodeMap = childGraph.getMapHNodetoMergeSet(); @@ -704,7 +814,6 @@ public class LocationInference { } // copies nodes/edges from the parent class... - Set parentNodeSet = parentGraph.getNodeSet(); for (Iterator iterator2 = parentNodeSet.iterator(); iterator2.hasNext();) { HNode parentHNode = (HNode) iterator2.next(); @@ -736,6 +845,12 @@ public class LocationInference { HierarchyGraph parentMethodGraph = getHierarchyGraph(parentMethodDesc); HierarchyGraph childMethodGraph = getHierarchyGraph(childMethodDescriptor); + Set 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> parentMethodMergeNodeMap = parentMethodGraph.getMapHNodetoMergeSet(); @@ -3724,7 +3839,9 @@ public class LocationInference { private void calculateExtraLocations() { - LinkedList methodDescList = ssjava.getSortedDescriptors(); + // LinkedList methodDescList = ssjava.getSortedDescriptors(); + LinkedList methodDescList = + (LinkedList) toanalyze_methodDescList.clone(); for (Iterator iterator = methodDescList.iterator(); iterator.hasNext();) { MethodDescriptor md = (MethodDescriptor) iterator.next(); if (!ssjava.getMethodContainingSSJavaLoop().equals(md)) { @@ -4852,18 +4969,18 @@ public class LocationInference { // hack... it seems that there is a problem with topological sorting. // so String.toString(Object o) is appeared too higher in the call chain. - MethodDescriptor mdToString = null; - for (Iterator iterator = toanalyze_methodDescList.iterator(); iterator.hasNext();) { - MethodDescriptor md = (MethodDescriptor) iterator.next(); - if (md.toString().equals("public static String String.valueOf(Object o)")) { - mdToString = md; - break; - } - } - if (mdToString != null) { - toanalyze_methodDescList.remove(mdToString); - toanalyze_methodDescList.addLast(mdToString); - } + // MethodDescriptor mdToString = null; + // for (Iterator iterator = toanalyze_methodDescList.iterator(); iterator.hasNext();) { + // MethodDescriptor md = (MethodDescriptor) iterator.next(); + // if (md.toString().equals("public static String String.valueOf(Object o)")) { + // mdToString = md; + // break; + // } + // } + // if (mdToString != null) { + // toanalyze_methodDescList.remove(mdToString); + // toanalyze_methodDescList.addLast(mdToString); + // } LinkedList methodDescList = (LinkedList) toanalyze_methodDescList.clone();