Package soot.jimple.toolkits.thread.mhp
Class PegGraph
- java.lang.Object
-
- soot.jimple.toolkits.thread.mhp.PegGraph
-
- All Implemented Interfaces:
Iterable,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
Fields Modifier and Type Field Description protected Map<AllocNode,String>allocNodeToObjprotected Map<AllocNode,PegChain>allocNodeToThreadprotected Map<JPegStmt,Chain>joinStmtToThreadHashMapstartToAllocNodesHashMap<JPegStmt,List>startToThreadprotected MapthreadNameToStartprotected MapthreadNoprotected HashMap<Object,List>unitToPredsprotected HashMap<Object,List>unitToSuccs
-
Constructor Summary
Constructors Constructor Description PegGraph(CallGraph callGraph, Hierarchy hierarchy, PAG pag, Set<Object> methodsNeedingInlining, Set<AllocNode> allocNodes, List inlineSites, Map synchObj, Set<AllocNode> 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<List> inlineSites, Map<SootMethod,String> synchObj, Set multiRunAllocNodes, Map<AllocNode,String> 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMonitorStmt()booleanaddPeg(PegGraph pg, Chain chain)protected voidaddTag()protected voidbuildMaps(PegGraph pg)protected voidbuildPreds()protected voidbuildSuccsForInlining(JPegStmt stmt, Chain chain, PegGraph inlinee)protected voidcomputeEdgeAndThreadNo()voidcomputeMonitorObjs()protected FlowSetgetAllNodes()protected Map<AllocNode,String>getAllocNodeToObj()Map<AllocNode,PegChain>getAllocNodeToThread()BodygetBody()SetgetCanNotBeCompacted()protected Set<Unit>getExceHandlers()ListgetHeads()Returns a list of entry points for this graph.protected Map<JPegStmt,Chain>getJoinStmtToThread()PegChaingetMainPegChain()SetgetMethodsNeedingInlining()Map<String,FlowSet>getMonitor()Set<Object>getMonitorObjs()protected booleangetNeedInlining()Map<String,Set<JPegStmt>>getNotifyAll()ListgetPredsOf(Object s)Returns a list of predecessors for the given node in the graph.protected Set<JPegStmt>getSpecialJoin()MapgetStartToAllocNodes()protected MapgetStartToBeginNodes()Map<JPegStmt,List>getStartToThread()ListgetSuccsOf(Object s)Returns a list of successors for the given node in the graph.HashSet<List>getSynch()ListgetTails()Returns a list of exit points for this graph.protected SetgetThreadAllocSites()protected MapgetThreadNameToStart()protected MapgetUnitToPegMap()protected HashMapgetUnitToPreds()protected HashMapgetUnitToSuccs()protected Map<String,FlowSet>getWaitingNodes()Iteratoriterator()Returns an iterator for the nodes in this graph.IteratormainIterator()protected voidsetMonitor(Map<String,FlowSet> m)intsize()Returns the node count for this graph.protected voidtestIterator()protected voidtestJoinStmtToThread()protected voidtestList(List list)voidtestMonitor()protected voidtestPegChain(Chain chain)protected voidtestSet(Set set, String name)protected voidtestStartToThread()protected voidtestSynch()protected voidtestThreadNameToStart()protected voidtestUnitToPeg(HashMap unitToPeg)protected voidtestUnitToPred()protected voidtestUnitToSucc()voidtestWaitingNodes()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
PegGraph
public PegGraph(CallGraph callGraph, Hierarchy hierarchy, PAG pag, Set<Object> methodsNeedingInlining, Set<AllocNode> allocNodes, List inlineSites, Map synchObj, Set<AllocNode> 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:
Body- The underlying body of main threadaddExceptionEdges- If true then the control flow edges associated with exceptions are added.Hierarchy- Using class hierarchy analysis to find the run method of started threadPointsToAnalysis- Using point to analysis (SPARK package) to improve the precision of results
-
PegGraph
public PegGraph(CallGraph callGraph, Hierarchy hierarchy, PAG pag, Set methodsNeedingInlining, Set allocNodes, List<List> inlineSites, Map<SootMethod,String> synchObj, Set multiRunAllocNodes, Map<AllocNode,String> 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:
body- The underlying body we want to make a graph for.addExceptionEdges- If true then the control flow edges associated with exceptions are added.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.Hierarchy- Using class hierarchy analysis to find the run method of started threadPointsToAnalysis- Using point to analysis (SPARK package) to improve the precision of results
-
-
Method Detail
-
getStartToBeginNodes
protected Map getStartToBeginNodes()
-
getUnitToPegMap
protected Map getUnitToPegMap()
-
addMonitorStmt
protected void addMonitorStmt()
-
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:DirectedGraphReturns a list of entry points for this graph.- Specified by:
getHeadsin interfaceDirectedGraph
-
getTails
public List getTails()
Description copied from interface:DirectedGraphReturns a list of exit points for this graph.- Specified by:
getTailsin interfaceDirectedGraph
-
getPredsOf
public List getPredsOf(Object s)
Description copied from interface:DirectedGraphReturns a list of predecessors for the given node in the graph.- Specified by:
getPredsOfin interfaceDirectedGraph
-
getSuccsOf
public List getSuccsOf(Object s)
Description copied from interface:DirectedGraphReturns a list of successors for the given node in the graph.- Specified by:
getSuccsOfin interfaceDirectedGraph
-
getCanNotBeCompacted
public Set getCanNotBeCompacted()
-
size
public int size()
Description copied from interface:DirectedGraphReturns the node count for this graph.- Specified by:
sizein interfaceDirectedGraph
-
mainIterator
public Iterator mainIterator()
-
iterator
public Iterator iterator()
Description copied from interface:DirectedGraphReturns an iterator for the nodes in this graph. No specific ordering of the nodes is guaranteed.- Specified by:
iteratorin interfaceDirectedGraph- Specified by:
iteratorin interfaceIterable
-
getThreadAllocSites
protected Set getThreadAllocSites()
-
getStartToAllocNodes
public Map getStartToAllocNodes()
-
getThreadNameToStart
protected Map getThreadNameToStart()
-
getMainPegChain
public PegChain getMainPegChain()
-
getMethodsNeedingInlining
public Set getMethodsNeedingInlining()
-
testIterator
protected void testIterator()
-
testWaitingNodes
public void testWaitingNodes()
-
testStartToThread
protected void testStartToThread()
-
testUnitToPeg
protected void testUnitToPeg(HashMap unitToPeg)
-
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()
-
testList
protected void testList(List list)
-
testMonitor
public void testMonitor()
-
-