// map a method/class descriptor to a skeleton hierarchy graph with combination nodes
private Map<Descriptor, HierarchyGraph> mapDescriptorToCombineSkeletonHierarchyGraph;
- // map a descriptor to a simple lattice
- private Map<Descriptor, SSJavaLattice<String>> mapDescriptorToSimpleLattice;
+ // map a descriptor to a skeleton lattice
+ private Map<Descriptor, SSJavaLattice<String>> mapDescriptorToSkeletonLattice;
// map a method descriptor to the set of method invocation nodes which are
// invoked by the method descriptor
this.mapDescriptorToCombineSkeletonHierarchyGraph = new HashMap<Descriptor, HierarchyGraph>();
this.mapDescriptorToSimpleHierarchyGraph = new HashMap<Descriptor, HierarchyGraph>();
- this.mapDescriptorToSimpleLattice = new HashMap<Descriptor, SSJavaLattice<String>>();
+ this.mapDescriptorToSkeletonLattice = new HashMap<Descriptor, SSJavaLattice<String>>();
this.mapDescToLocationSummary = new HashMap<Descriptor, LocationSummary>();
while (!methodDescList.isEmpty()) {
MethodDescriptor md = methodDescList.removeLast();
- // System.out.println("\n#updateCompositeLocationAssignments=" + md);
+ System.out.println("\n#updateCompositeLocationAssignments=" + md);
FlowGraph flowGraph = getFlowGraph(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());
+ 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);
+ System.out.println("---updatedCompLoc1=" + updatedCompLoc);
} else {
NTuple<Descriptor> descTuple = node.getDescTuple();
// System.out.println("update desc=" + descTuple);
HierarchyGraph scGraph = getSimpleHierarchyGraph(enclosingDesc);
if (scGraph != null) {
HNode curNode = scGraph.getCurrentHNode(nodeIdentifier);
- // System.out.println("nodeID=" + nodeIdentifier + " curNode=" + curNode
- // + " enclosingDesc=" + enclosingDesc);
+ System.out.println(" nodeID=" + nodeIdentifier + " curNode=" + curNode
+ + " enclosingDesc=" + enclosingDesc);
if (curNode != null) {
nodeIdentifier = curNode.getName();
}
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 void debug_writeLattices() {
- Set<Descriptor> keySet = mapDescriptorToSimpleLattice.keySet();
+ Set<Descriptor> keySet = mapDescriptorToSkeletonLattice.keySet();
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
Descriptor key = (Descriptor) iterator.next();
- SSJavaLattice<String> simpleLattice = mapDescriptorToSimpleLattice.get(key);
+ SSJavaLattice<String> skeletonLattice = mapDescriptorToSkeletonLattice.get(key);
// HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(key);
HierarchyGraph scHierarchyGraph = getSkeletonCombinationHierarchyGraph(key);
if (key instanceof ClassDescriptor) {
- // writeInferredLatticeDotFile((ClassDescriptor) key, scHierarchyGraph, simpleLattice,
- // "_SIMPLE");
+ writeInferredLatticeDotFile((ClassDescriptor) key, skeletonLattice, "_SKELETON");
} else if (key instanceof MethodDescriptor) {
MethodDescriptor md = (MethodDescriptor) key;
- // writeInferredLatticeDotFile(md.getClassDesc(), md, scHierarchyGraph, simpleLattice,
- // "_SIMPLE");
+ writeInferredLatticeDotFile(md.getClassDesc(), md, skeletonLattice, "_SKELETON");
}
LocationSummary ls = getLocationSummary(key);
private void buildLattice(Descriptor desc) {
// System.out.println("buildLattice=" + desc);
- SSJavaLattice<String> simpleLattice = buildLattice.buildLattice(desc);
+ SSJavaLattice<String> skeletonLattice = buildLattice.buildLattice(desc);
+
+ addMapDescToSkeletonLattice(desc, skeletonLattice);
- addMapDescToSimpleLattice(desc, simpleLattice);
+ // write a dot file before everything is done
+ if (desc instanceof ClassDescriptor) {
+ writeInferredLatticeDotFile((ClassDescriptor) desc, null, skeletonLattice, "_SC");
+ } else {
+ MethodDescriptor md = (MethodDescriptor) desc;
+ writeInferredLatticeDotFile(md.getClassDesc(), md, skeletonLattice, "_SC");
+ }
HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(desc);
+
// System.out.println("\n## insertIntermediateNodesToStraightLine:"
// + simpleHierarchyGraph.getName());
SSJavaLattice<String> lattice =
- buildLattice.insertIntermediateNodesToStraightLine(desc, simpleLattice);
+ buildLattice.insertIntermediateNodesToStraightLine(desc, skeletonLattice);
+
+ if (lattice == null) {
+ return;
+ }
lattice.removeRedundantEdges();
LocationInference.numLocationsSInfer += lattice.getKeySet().size();
+ System.out.println(desc + " numPaths=" + lattice.countPaths());
if (desc instanceof ClassDescriptor) {
// field lattice
cd2lattice.put((ClassDescriptor) desc, lattice);
- // ssjava.writeLatticeDotFile((ClassDescriptor) desc, null, lattice);
+ ssjava.writeLatticeDotFile((ClassDescriptor) desc, null, lattice);
} else if (desc instanceof MethodDescriptor) {
// method lattice
md2lattice.put((MethodDescriptor) desc, lattice);
MethodDescriptor md = (MethodDescriptor) desc;
ClassDescriptor cd = md.getClassDesc();
- // ssjava.writeLatticeDotFile(cd, md, lattice);
+ ssjava.writeLatticeDotFile(cd, md, lattice);
}
}
SSJavaLattice<String> simpleLattice = buildLattice.buildLattice(desc);
- addMapDescToSimpleLattice(desc, simpleLattice);
+ addMapDescToSkeletonLattice(desc, simpleLattice);
HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(desc);
System.out.println("\n## insertIntermediateNodesToStraightLine:"
}
- public void addMapDescToSimpleLattice(Descriptor desc, SSJavaLattice<String> lattice) {
- mapDescriptorToSimpleLattice.put(desc, lattice);
+ public void addMapDescToSkeletonLattice(Descriptor desc, SSJavaLattice<String> lattice) {
+ mapDescriptorToSkeletonLattice.put(desc, lattice);
}
- public SSJavaLattice<String> getSimpleLattice(Descriptor desc) {
- return mapDescriptorToSimpleLattice.get(desc);
+ public SSJavaLattice<String> getSkeletonLattice(Descriptor desc) {
+ return mapDescriptorToSkeletonLattice.get(desc);
}
private void simplifyHierarchyGraph() {
HierarchyGraph simpleHierarchyGraph = getHierarchyGraph(desc).clone();
simpleHierarchyGraph.setName(desc + "_SIMPLE");
simpleHierarchyGraph.removeRedundantEdges();
+ // simpleHierarchyGraph.removeIsolatedNodes();
mapDescriptorToSimpleHierarchyGraph.put(desc, simpleHierarchyGraph);
}
}
System.out.println("\nSSJAVA: Inserting Combination Nodes:" + desc);
HierarchyGraph skeletonGraph = getSkeletonHierarchyGraph(desc);
HierarchyGraph skeletonGraphWithCombinationNode = skeletonGraph.clone();
+ skeletonGraphWithCombinationNode.setSCGraph(true);
skeletonGraphWithCombinationNode.setName(desc + "_SC");
HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(desc);
// if the srcNode is started with the global descriptor
// need to set as a skeleton node
if (!hasGlobalAccess && srcNode.getDescTuple().startsWith(GLOBALDESC)) {
+ System.out.println("SRCNODE=" + srcNode);
hasGlobalAccess = true;
}
// set hasGloabalAccess true in the method summary.
if (hasGlobalAccess) {
getMethodSummary(md).setHasGlobalAccess();
+ methodGraph.getHNode(GLOBALDESC).setSkeleton(true);
}
- methodGraph.getHNode(GLOBALDESC).setSkeleton(true);
if (ssjava.getMethodContainingSSJavaLoop().equals(md)) {
// if the current method contains the event loop