chord.analyses.alias
Class CICG

java.lang.Object
  extended by chord.util.graph.AbstractGraph<joeq.Class.jq_Method>
      extended by chord.analyses.alias.CICG
All Implemented Interfaces:
ICICG, IGraph<joeq.Class.jq_Method>, ILabeledGraph<joeq.Class.jq_Method,joeq.Compiler.Quad.Quad>, java.io.Serializable

public class CICG
extends AbstractGraph<joeq.Class.jq_Method>
implements ICICG

Implementation of a context-insensitive call graph.

Author:
Mayur Naik (mhn@cs.stanford.edu)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class chord.util.graph.AbstractGraph
cached
 
Constructor Summary
CICG(DomM domM, ProgramRel relRootM, ProgramRel relReachableM, ProgramRel relIM, ProgramRel relMM)
           
 
Method Summary
 boolean calls(joeq.Compiler.Quad.Quad invk, joeq.Class.jq_Method meth)
          Determines whether a given call site may call a given method.
 void free()
          Frees relations used by this call graph if they are in memory.
 java.util.Set<joeq.Compiler.Quad.Quad> getCallers(joeq.Class.jq_Method meth)
          Provides the set of all call sites that may call a given method.
 java.util.Set<joeq.Compiler.Quad.Quad> getLabels(joeq.Class.jq_Method srcMeth, joeq.Class.jq_Method dstMeth)
          Provides the set of all labels on a given directed edge in the graph.
 java.util.Set<joeq.Class.jq_Method> getNodes()
          Provides all nodes in this graph.
 java.util.Set<joeq.Class.jq_Method> getPreds(joeq.Class.jq_Method meth)
          Provides all immediate predecessors of a given node in this graph.
 java.util.Set<joeq.Class.jq_Method> getRoots()
          Provides all root nodes of this graph.
 java.util.Set<joeq.Class.jq_Method> getSuccs(joeq.Class.jq_Method meth)
          Provides all immediate successors of a given node in this graph.
 java.util.Set<joeq.Class.jq_Method> getTargets(joeq.Compiler.Quad.Quad invk)
          Provides the set of all methods that may be called by a given call site.
 boolean hasEdge(joeq.Class.jq_Method meth1, joeq.Class.jq_Method meth2)
          Determines whether this graph contains a given directed edge.
 boolean hasNode(joeq.Class.jq_Method meth)
          Determines whether this graph contains a given node.
 boolean hasRoot(joeq.Class.jq_Method meth)
          Determines whether this graph contains a given node as a root node.
 int numNodes()
          Provides the total number of nodes in this graph.
 int numPreds(joeq.Class.jq_Method node)
          Provides the number of immediate predecessors of a given node in this graph.
 int numRoots()
          Provides the total number of roots of this graph.
 int numSuccs(joeq.Class.jq_Method node)
          Provides the number of immediate successors of a given node in this graph.
 
Methods inherited from class chord.util.graph.AbstractGraph
equals, evictCache, getAllPathsBuilder, getBackEdges, getNodeMap, getNodesInCycles, getNodesInRPO, getShortestPathsBuilder, getSimpleCycles, getTopSortedSCCs, hasCycles, hashCode, isConnected, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface chord.util.graph.IGraph
getAllPathsBuilder, getBackEdges, getNodeMap, getNodesInCycles, getNodesInRPO, getShortestPathsBuilder, getSimpleCycles, getTopSortedSCCs, hasCycles, isConnected
 

Constructor Detail

CICG

public CICG(DomM domM,
            ProgramRel relRootM,
            ProgramRel relReachableM,
            ProgramRel relIM,
            ProgramRel relMM)
Method Detail

getCallers

public java.util.Set<joeq.Compiler.Quad.Quad> getCallers(joeq.Class.jq_Method meth)
Description copied from interface: ICICG
Provides the set of all call sites that may call a given method.

Specified by:
getCallers in interface ICICG
Parameters:
meth - A method.
Returns:
The set of all call sites that may call method meth.

getTargets

public java.util.Set<joeq.Class.jq_Method> getTargets(joeq.Compiler.Quad.Quad invk)
Description copied from interface: ICICG
Provides the set of all methods that may be called by a given call site.

Specified by:
getTargets in interface ICICG
Parameters:
invk - A call site.
Returns:
The set of all methods that may be called by call site invk.

numRoots

public int numRoots()
Description copied from interface: IGraph
Provides the total number of roots of this graph.

Specified by:
numRoots in interface IGraph<joeq.Class.jq_Method>
Returns:
The total number of roots of this graph.

numNodes

public int numNodes()
Description copied from interface: IGraph
Provides the total number of nodes in this graph.

Specified by:
numNodes in interface IGraph<joeq.Class.jq_Method>
Returns:
The total number of nodes in this graph.

numPreds

public int numPreds(joeq.Class.jq_Method node)
Description copied from interface: IGraph
Provides the number of immediate predecessors of a given node in this graph.

Specified by:
numPreds in interface IGraph<joeq.Class.jq_Method>
Parameters:
node - A node.
Returns:
The number of immediate predecessors of the given node, if it exists in this graph, and 0 otherwise.

numSuccs

public int numSuccs(joeq.Class.jq_Method node)
Description copied from interface: IGraph
Provides the number of immediate successors of a given node in this graph.

Specified by:
numSuccs in interface IGraph<joeq.Class.jq_Method>
Parameters:
node - A node.
Returns:
The number of immediate successors of the given node, if it exists in this graph, and 0 otherwise.

getRoots

public java.util.Set<joeq.Class.jq_Method> getRoots()
Description copied from interface: IGraph
Provides all root nodes of this graph.

Specified by:
getRoots in interface IGraph<joeq.Class.jq_Method>
Returns:
All root nodes of this graph.

getNodes

public java.util.Set<joeq.Class.jq_Method> getNodes()
Description copied from interface: IGraph
Provides all nodes in this graph.

Specified by:
getNodes in interface IGraph<joeq.Class.jq_Method>
Returns:
All nodes in this graph.

getPreds

public java.util.Set<joeq.Class.jq_Method> getPreds(joeq.Class.jq_Method meth)
Description copied from interface: IGraph
Provides all immediate predecessors of a given node in this graph.

Specified by:
getPreds in interface IGraph<joeq.Class.jq_Method>
Parameters:
meth - A node.
Returns:
All immediate predecessors of the given node.

getSuccs

public java.util.Set<joeq.Class.jq_Method> getSuccs(joeq.Class.jq_Method meth)
Description copied from interface: IGraph
Provides all immediate successors of a given node in this graph.

Specified by:
getSuccs in interface IGraph<joeq.Class.jq_Method>
Parameters:
meth - A node.
Returns:
All immediate successors of the given node.

getLabels

public java.util.Set<joeq.Compiler.Quad.Quad> getLabels(joeq.Class.jq_Method srcMeth,
                                                        joeq.Class.jq_Method dstMeth)
Description copied from interface: ILabeledGraph
Provides the set of all labels on a given directed edge in the graph.

Specified by:
getLabels in interface ILabeledGraph<joeq.Class.jq_Method,joeq.Compiler.Quad.Quad>
Parameters:
srcMeth - The source node of the edge.
dstMeth - The target node of the edge.
Returns:
The set of all labels on the edge from srcNode to dstNode in the graph. It is the empty set if either node does not exist, the edge does not exist, or no labels exist on the edge in the graph.

calls

public boolean calls(joeq.Compiler.Quad.Quad invk,
                     joeq.Class.jq_Method meth)
Description copied from interface: ICICG
Determines whether a given call site may call a given method.

Specified by:
calls in interface ICICG
Parameters:
invk - A call site.
meth - A method.
Returns:
true iff call site invk may call method meth.

hasRoot

public boolean hasRoot(joeq.Class.jq_Method meth)
Description copied from interface: IGraph
Determines whether this graph contains a given node as a root node.

Specified by:
hasRoot in interface IGraph<joeq.Class.jq_Method>
Parameters:
meth - A node.
Returns:
true if this graph contains the given node as a root node.

hasNode

public boolean hasNode(joeq.Class.jq_Method meth)
Description copied from interface: IGraph
Determines whether this graph contains a given node.

Specified by:
hasNode in interface IGraph<joeq.Class.jq_Method>
Parameters:
meth - A node.
Returns:
true if this graph contains the given node.

hasEdge

public boolean hasEdge(joeq.Class.jq_Method meth1,
                       joeq.Class.jq_Method meth2)
Description copied from interface: IGraph
Determines whether this graph contains a given directed edge.

Specified by:
hasEdge in interface IGraph<joeq.Class.jq_Method>
Parameters:
meth1 - A node.
meth2 - A node.
Returns:
true if this graph contains a directed edge from node1 to node2.

free

public void free()
Frees relations used by this call graph if they are in memory.

This method must be called after clients are done exercising the interface of this call graph.