soot.jimple.toolkits.thread.mhp
Class PegGraph

java.lang.Object
  extended bysoot.jimple.toolkits.thread.mhp.PegGraph
All Implemented Interfaces:
DirectedGraph

public class PegGraph
extends Object
implements DirectedGraph

Oct. 7, 2003 modify buildPegChain() for building chain without inliner. June 19, 2003 add begin node to peg June 18, 2003 modify the iterator() to be iterator for all nodes of PEG and mainIterator() to be the iterator for main chain. June 12, 2003 add monitor Map, notifyAll Map, waitingNodes Map.


Field Summary
protected  Map allocNodeToObj
           
protected  Map allocNodeToThread
           
protected  Map joinStmtToThread
           
 HashMap startToAllocNodes
           
 HashMap startToThread
           
protected  Map threadNameToStart
           
protected  Map threadNo
           
protected  HashMap unitToPreds
           
protected  HashMap unitToSuccs
           
 
Constructor Summary
PegGraph(CallGraph callGraph, Hierarchy hierarchy, PAG pag, Set methodsNeedingInlining, Set allocNodes, List inlineSites, Map synchObj, Set multiRunAllocNodes, Map allocNodeToObj, Body unitBody, SootMethod sm, boolean addExceptionEdges, boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
          Constructs a graph for the units found in the provided Body instance.
PegGraph(CallGraph callGraph, Hierarchy hierarchy, PAG pag, Set methodsNeedingInlining, Set allocNodes, List inlineSites, Map synchObj, Set multiRunAllocNodes, Map allocNodeToObj, Body unitBody, String threadName, SootMethod sm, boolean addExceEdge, boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
          Constructs a graph for the units found in the provided Body instance.
 
Method Summary
protected  void addMonitorStmt()
           
 boolean addPeg(PegGraph pg, Chain chain)
           
protected  void addTag()
           
protected  void buildMaps(PegGraph pg)
           
protected  void buildPreds()
           
protected  void buildSuccsForInlining(JPegStmt stmt, Chain chain, PegGraph inlinee)
           
protected  void computeEdgeAndThreadNo()
           
 void computeMonitorObjs()
           
protected  FlowSet getAllNodes()
           
protected  Map getAllocNodeToObj()
           
 Map getAllocNodeToThread()
           
 Body getBody()
           
 Set getCanNotBeCompacted()
           
protected  Set getExceHandlers()
           
 List getHeads()
          Returns a list of entry points for this graph.
protected  Map getJoinStmtToThread()
           
 PegChain getMainPegChain()
           
 Set getMethodsNeedingInlining()
           
 Map getMonitor()
           
 Set getMonitorObjs()
           
protected  boolean getNeedInlining()
           
 Map getNotifyAll()
           
 List getPredsOf(Object s)
          Returns a list of predecessors for the given node in the graph.
protected  Set getSpecialJoin()
           
 Map getStartToAllocNodes()
           
protected  Map getStartToBeginNodes()
           
 Map getStartToThread()
           
 List getSuccsOf(Object s)
          Returns a list of successors for the given node in the graph.
 HashSet getSynch()
           
 List getTails()
          Returns a list of exit points for this graph.
protected  Set getThreadAllocSites()
           
protected  Map getThreadNameToStart()
           
protected  Map getUnitToPegMap()
           
protected  HashMap getUnitToPreds()
           
protected  HashMap getUnitToSuccs()
           
protected  Map getWaitingNodes()
           
 Iterator iterator()
          Returns an iterator for the nodes in this graph.
 Iterator mainIterator()
           
protected  void setMonitor(Map m)
           
 int size()
          Returns the node count for this graph.
protected  void testIterator()
           
protected  void testJoinStmtToThread()
           
 void testMonitor()
           
protected  void testPegChain(Chain chain)
           
protected  void testStartToThread()
           
protected  void testSynch()
           
protected  void testThreadNameToStart()
           
protected  void testUnitToPred()
           
protected  void testUnitToSucc()
           
 void testWaitingNodes()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

unitToSuccs

protected HashMap unitToSuccs

unitToPreds

protected HashMap unitToPreds

startToThread

public HashMap startToThread

startToAllocNodes

public HashMap startToAllocNodes

threadNo

protected Map threadNo

threadNameToStart

protected Map threadNameToStart

allocNodeToObj

protected Map allocNodeToObj

allocNodeToThread

protected Map allocNodeToThread

joinStmtToThread

protected Map joinStmtToThread
Constructor Detail

PegGraph

public PegGraph(CallGraph callGraph,
                Hierarchy hierarchy,
                PAG pag,
                Set methodsNeedingInlining,
                Set allocNodes,
                List inlineSites,
                Map synchObj,
                Set multiRunAllocNodes,
                Map allocNodeToObj,
                Body unitBody,
                SootMethod sm,
                boolean addExceptionEdges,
                boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
Constructs a graph for the units found in the provided Body instance. Each node in the graph corresponds to a unit. The edges are derived from the control flow.

Parameters:
addExceptionEdges - If true then the control flow edges associated with exceptions are added.

PegGraph

public PegGraph(CallGraph callGraph,
                Hierarchy hierarchy,
                PAG pag,
                Set methodsNeedingInlining,
                Set allocNodes,
                List inlineSites,
                Map synchObj,
                Set multiRunAllocNodes,
                Map allocNodeToObj,
                Body unitBody,
                String threadName,
                SootMethod sm,
                boolean addExceEdge,
                boolean dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock)
Constructs a graph for the units found in the provided Body instance. Each node in the graph corresponds to a unit. The edges are derived from the control flow.

Parameters:
dontAddEdgeFromStmtBeforeAreaOfProtectionToCatchBlock - This was added for Dava. If true, edges are not added from statement before area of protection to catch. If false, edges ARE added. For Dava, it should be true. For flow analyses, it should be false.
Method Detail

getStartToBeginNodes

protected Map getStartToBeginNodes()

getJoinStmtToThread

protected Map getJoinStmtToThread()

getUnitToPegMap

protected Map getUnitToPegMap()

addMonitorStmt

protected void addMonitorStmt()

addPeg

public boolean addPeg(PegGraph pg,
                      Chain chain)

buildSuccsForInlining

protected void buildSuccsForInlining(JPegStmt stmt,
                                     Chain chain,
                                     PegGraph inlinee)

buildMaps

protected void buildMaps(PegGraph pg)

buildPreds

protected void buildPreds()

computeMonitorObjs

public void computeMonitorObjs()

getNeedInlining

protected boolean getNeedInlining()

getAllNodes

protected FlowSet getAllNodes()

getUnitToSuccs

protected HashMap getUnitToSuccs()

getUnitToPreds

protected HashMap getUnitToPreds()

getBody

public Body getBody()

getHeads

public List getHeads()
Description copied from interface: DirectedGraph
Returns a list of entry points for this graph.

Specified by:
getHeads in interface DirectedGraph

getTails

public List getTails()
Description copied from interface: DirectedGraph
Returns a list of exit points for this graph.

Specified by:
getTails in interface DirectedGraph

getPredsOf

public List getPredsOf(Object s)
Description copied from interface: DirectedGraph
Returns a list of predecessors for the given node in the graph.

Specified by:
getPredsOf in interface DirectedGraph

getSuccsOf

public List getSuccsOf(Object s)
Description copied from interface: DirectedGraph
Returns a list of successors for the given node in the graph.

Specified by:
getSuccsOf in interface DirectedGraph

getCanNotBeCompacted

public Set getCanNotBeCompacted()

size

public int size()
Description copied from interface: DirectedGraph
Returns the node count for this graph.

Specified by:
size in interface DirectedGraph

mainIterator

public Iterator mainIterator()

iterator

public Iterator iterator()
Description copied from interface: DirectedGraph
Returns an iterator for the nodes in this graph. No specific ordering of the nodes is guaranteed.

Specified by:
iterator in interface DirectedGraph

toString

public String toString()

getExceHandlers

protected Set getExceHandlers()

setMonitor

protected void setMonitor(Map m)

getMonitor

public Map getMonitor()

getMonitorObjs

public Set getMonitorObjs()

getThreadAllocSites

protected Set getThreadAllocSites()

getSpecialJoin

protected Set getSpecialJoin()

getSynch

public HashSet getSynch()

getStartToThread

public Map getStartToThread()

getStartToAllocNodes

public Map getStartToAllocNodes()

getWaitingNodes

protected Map getWaitingNodes()

getNotifyAll

public Map getNotifyAll()

getAllocNodeToObj

protected Map getAllocNodeToObj()

getAllocNodeToThread

public Map getAllocNodeToThread()

getThreadNameToStart

protected Map getThreadNameToStart()

getMainPegChain

public PegChain getMainPegChain()

getMethodsNeedingInlining

public Set getMethodsNeedingInlining()

testIterator

protected void testIterator()

testWaitingNodes

public void testWaitingNodes()

testStartToThread

protected void testStartToThread()

testUnitToSucc

protected void testUnitToSucc()

testUnitToPred

protected void testUnitToPred()

addTag

protected void addTag()

testSynch

protected void testSynch()

testThreadNameToStart

protected void testThreadNameToStart()

testJoinStmtToThread

protected void testJoinStmtToThread()

testPegChain

protected void testPegChain(Chain chain)

computeEdgeAndThreadNo

protected void computeEdgeAndThreadNo()

testMonitor

public void testMonitor()