|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph soot.toolkits.graph.pdg.HashMutablePDG
public class HashMutablePDG
This class implements a Program Dependence Graph as defined in Ferrante, J., Ottenstein, K. J., and Warren, J. D. 1987. The program dependence graph and its use in optimization. ACM Trans. Program. Lang. Syst. 9, 3 (Jul. 1987), 319-349. DOI= http://doi.acm.org/10.1145/24039.24041 Note: the implementation is not exactly as in the above paper. It first finds the regions of control dependence then uses part of the algorithm given in the above paper to build the graph. The constructor accepts a UnitGraph, which can be a BriefUnitGraph, an ExceptionalUnitGraph, or an EnhancedUnitGraph. At the absence of exception handling constructs in a method, all of these work the same. However, at the presence of exception handling constructs, BriefUnitGraph is multi-headed and potentially multi-tailed which makes the results of RegionAnalysis and PDG construction unreliable (It's not clear if it would be useful anyway); Also, ExceptionalGraph's usefulness when exception handling is present is not so clear since almost every unit can throw exception hence the dependency is affected. Currently, the PDG is based on a UnitGraph (BlockGraph) and does not care whether flow is exceptional or not. The nodes in a PDG are of type PDGNode and the edges can have three labels: "dependency", "dependency-back", and "controlflow"; however, the "controlflow" edges are auxiliary and the dependencies are represented by the labels beginning with "dependency". Other labels can be added later for application or domain-specific cases. To support methods that contain exception-handling and multiple-heads or tails, use EnhancedUnitGraph. It does not represent exceptional flow in the way ExceptionalUnitGraph does, but it integrates them in a concise way. Also, it adds START/STOP nodes to graph if necessary to make the graph single entry single exit.
Field Summary | |
---|---|
protected BlockGraph |
m_blockCFG
|
protected Body |
m_body
|
protected UnitGraph |
m_cfg
|
protected SootClass |
m_class
|
protected Hashtable<Object,PDGNode> |
m_obj2pdgNode
|
protected List<PDGRegion> |
m_pdgRegions
|
protected PDGNode |
m_startNode
|
protected List<Region> |
m_strongRegions
|
protected List<Region> |
m_weakRegions
|
Fields inherited from class soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph |
---|
edgeToLabels, heads, labelToEdges, nodeToPreds, nodeToSuccs, tails |
Constructor Summary | |
---|---|
HashMutablePDG(UnitGraph cfg)
|
Method Summary | |
---|---|
protected void |
constructPDG()
This is the heart of the PDG contruction. |
boolean |
dependentOn(PDGNode node1,
PDGNode node2)
This method determines if node1 is control-dependent on node2 in this PDG. |
UnitGraph |
getCFG()
|
List<PDGNode> |
getDependents(PDGNode node)
This method returns the list of all dependents of a node in the PDG. |
PDGNode |
getPDGNode(Object cfgNode)
This method returns the PDGNode in the PDG corresponding to the given CFG node. |
List<PDGRegion> |
getPDGRegions()
This method returns the list of PDGRegions computed by the construction method. |
static List<PDGRegion> |
getPostorderPDGRegionList(PDGNode r)
This method returns a list of regions obtained by post-order traversal of the region hierarchy. |
static List<IRegion> |
getPostorderRegionList(IRegion r)
|
static List<IRegion> |
getPreorderRegionList(IRegion r)
|
PDGNode |
GetStartNode()
|
IRegion |
GetStartRegion()
|
List<Region> |
getStrongRegions()
|
List<Region> |
getWeakRegions()
|
void |
removeAllEdges(Object from,
Object to)
The existing removeAllEdges in the parent class seems to be throwing concurrentmodification exception most of the time. |
String |
toString()
|
Methods inherited from class soot.toolkits.graph.HashMutableEdgeLabelledDirectedGraph |
---|
addEdge, addNode, clearAll, clone, containsAnyEdge, containsAnyEdge, containsEdge, containsNode, getEdgesForLabel, getHeads, getLabelsForEdges, getNodes, getPredsOf, getSuccsOf, getTails, iterator, printGraph, removeAllEdges, removeEdge, removeNode, size |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface soot.toolkits.graph.MutableEdgeLabelledDirectedGraph |
---|
addEdge, addNode, containsAnyEdge, containsAnyEdge, containsEdge, containsNode, getEdgesForLabel, getLabelsForEdges, getNodes, removeAllEdges, removeEdge, removeNode |
Methods inherited from interface soot.toolkits.graph.DirectedGraph |
---|
getHeads, getPredsOf, getSuccsOf, getTails, iterator, size |
Field Detail |
---|
protected Body m_body
protected SootClass m_class
protected UnitGraph m_cfg
protected BlockGraph m_blockCFG
protected Hashtable<Object,PDGNode> m_obj2pdgNode
protected List<Region> m_weakRegions
protected List<Region> m_strongRegions
protected PDGNode m_startNode
protected List<PDGRegion> m_pdgRegions
Constructor Detail |
---|
public HashMutablePDG(UnitGraph cfg)
Method Detail |
---|
protected void constructPDG()
public UnitGraph getCFG()
public List<Region> getWeakRegions()
getWeakRegions
in interface ProgramDependenceGraph
public List<Region> getStrongRegions()
getStrongRegions
in interface ProgramDependenceGraph
public IRegion GetStartRegion()
GetStartRegion
in interface ProgramDependenceGraph
public PDGNode GetStartNode()
GetStartNode
in interface ProgramDependenceGraph
public static List<IRegion> getPreorderRegionList(IRegion r)
public static List<IRegion> getPostorderRegionList(IRegion r)
public List<PDGRegion> getPDGRegions()
getPDGRegions
in interface ProgramDependenceGraph
public static List<PDGRegion> getPostorderPDGRegionList(PDGNode r)
The
- root from which the traversal should begin.
public boolean dependentOn(PDGNode node1, PDGNode node2)
dependentOn
in interface ProgramDependenceGraph
public List<PDGNode> getDependents(PDGNode node)
getDependents
in interface ProgramDependenceGraph
node
- is the PDG node whose dependents are desired.
public PDGNode getPDGNode(Object cfgNode)
getPDGNode
in interface ProgramDependenceGraph
cfgNode
- is expected to be a node in CFG (currently only Block).
public void removeAllEdges(Object from, Object to)
removeAllEdges
in interface MutableEdgeLabelledDirectedGraph
removeAllEdges
in class HashMutableEdgeLabelledDirectedGraph
from
- out node for the edges to remove.to
- in node for the edges to remove.public String toString()
toString
in interface ProgramDependenceGraph
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |