soot.jimple.spark.pag
Class AbstractPAG

java.lang.Object
  extended bysoot.jimple.spark.pag.AbstractPAG
All Implemented Interfaces:
PointsToAnalysis
Direct Known Subclasses:
BDDPAG, PAG

public abstract class AbstractPAG
extends java.lang.Object
implements PointsToAnalysis

Pointer assignment graph.

Author:
Ondrej Lhotak

Field Summary
protected  java.util.Map alloc
           
protected  java.util.Map allocInv
           
protected  ChunkedQueue edgeQueue
           
protected  java.util.Map load
           
protected  java.util.Map loadInv
           
 int maxFinishNumber
           
protected  AbstractSparkOptions opts
           
protected  java.util.Map simple
           
protected  java.util.Map simpleInv
           
protected  java.util.Map store
           
protected  java.util.Map storeInv
           
protected  AbstractTypeManager typeManager
           
 
Fields inherited from interface soot.PointsToAnalysis
ARRAY_ELEMENTS_NODE, CAST_NODE, DEFAULT_CLASS_LOADER, DEFAULT_CLASS_LOADER_LOCAL, EXCEPTION_NODE, MAIN_CLASS_NAME_STRING, MAIN_CLASS_NAME_STRING_LOCAL, MAIN_THREAD_GROUP_NODE, MAIN_THREAD_GROUP_NODE_LOCAL, MAIN_THREAD_NODE, MAIN_THREAD_NODE_LOCAL, RETURN_NODE, RETURN_STRING_CONSTANT_NODE, STRING_ARRAY_NODE, STRING_ARRAY_NODE_LOCAL, STRING_NODE, STRING_NODE_LOCAL, THIS_NODE, THROW_NODE
 
Constructor Summary
AbstractPAG(AbstractSparkOptions opts)
           
 
Method Summary
 boolean addAllocEdge(AllocNode from, VarNode to)
           
 void addCallTarget(AbstractMethodPAG srcmpag, AbstractMethodPAG tgtmpag, Stmt s, java.lang.Object srcContext, java.lang.Object tgtContext)
          Adds method target as a possible target of the invoke expression in s.
 void addCallTarget(Edge e)
           
 void addDereference(VarNode base)
          Adds the base of a dereference to the list of dereferenced variables.
 boolean addEdge(Node from, Node to)
          Adds an edge to the graph, returning false if it was already there.
 boolean addLoadEdge(FieldRefNode from, VarNode to)
           
 boolean addSimpleEdge(VarNode from, VarNode to)
           
 boolean addStoreEdge(VarNode from, FieldRefNode to)
           
protected  boolean addToMap(java.util.Map m, Node key, Node value)
           
abstract  java.util.Iterator allocInvSourcesIterator()
           
 QueueReader allocNodeListener()
           
abstract  java.util.Iterator allocSourcesIterator()
           
abstract  boolean doAddAllocEdge(AllocNode from, VarNode to)
           
abstract  boolean doAddLoadEdge(FieldRefNode from, VarNode to)
           
abstract  boolean doAddSimpleEdge(VarNode from, VarNode to)
           
abstract  boolean doAddStoreEdge(VarNode from, FieldRefNode to)
           
 QueueReader edgeReader()
           
 AllocDotField findAllocDotField(AllocNode an, SparkField field)
          Finds the AllocDotField for base AllocNode an and field field, or returns null.
 ContextVarNode findContextVarNode(java.lang.Object baseValue, java.lang.Object context)
          Finds the ContextVarNode for base variable value and context context, or returns null.
 FieldRefNode findGlobalFieldRefNode(java.lang.Object baseValue, SparkField field)
          Finds the FieldRefNode for base variable value and field field, or returns null.
 GlobalVarNode findGlobalVarNode(java.lang.Object value)
          Finds the GlobalVarNode for the variable value, or returns null.
 FieldRefNode findLocalFieldRefNode(java.lang.Object baseValue, SparkField field)
          Finds the FieldRefNode for base variable value and field field, or returns null.
 LocalVarNode findLocalVarNode(java.lang.Object value)
          Finds the LocalVarNode for the variable value, or returns null.
 Numberer getAllocDotFieldNodeNumberer()
           
 Numberer getAllocNodeNumberer()
           
 java.util.List getDereferences()
          Returns list of dereferences variables.
 Numberer getFieldRefNodeNumberer()
           
 java.util.Map getNodeTags()
           
 int getNumAllocNodes()
           
 OnFlyCallGraph getOnFlyCallGraph()
           
 AbstractSparkOptions getOpts()
          Returns SparkOptions for this graph.
 P2SetFactory getSetFactory()
           
 AbstractTypeManager getTypeManager()
           
 Numberer getVarNodeNumberer()
           
abstract  java.util.Iterator loadInvSourcesIterator()
           
abstract  java.util.Iterator loadSourcesIterator()
           
 AllocDotField makeAllocDotField(AllocNode an, SparkField field)
          Finds or creates the AllocDotField for base variable baseValue and field field, of type t.
 AllocNode makeAllocNode(java.lang.Object newExpr, Type type, SootMethod m)
           
 AllocNode makeClassConstantNode(java.lang.String s)
           
 ContextVarNode makeContextVarNode(LocalVarNode base, java.lang.Object context)
          Finds or creates the ContextVarNode for base variable base and context context, of type type.
 ContextVarNode makeContextVarNode(java.lang.Object baseValue, Type baseType, java.lang.Object context, SootMethod method)
          Finds or creates the ContextVarNode for base variable baseValue and context context, of type type.
 FieldRefNode makeFieldRefNode(VarNode base, SparkField field)
          Finds or creates the FieldRefNode for base variable base and field field, of type type.
 FieldRefNode makeGlobalFieldRefNode(java.lang.Object baseValue, Type baseType, SparkField field)
          Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.
 GlobalVarNode makeGlobalVarNode(java.lang.Object value, Type type)
          Finds or creates the GlobalVarNode for the variable value, of type type.
 FieldRefNode makeLocalFieldRefNode(java.lang.Object baseValue, Type baseType, SparkField field, SootMethod method)
          Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.
 LocalVarNode makeLocalVarNode(java.lang.Object value, Type type, SootMethod method)
          Finds or creates the LocalVarNode for the variable value, of type type.
 AllocNode makeStringConstantNode(java.lang.String s)
           
 GlobalNodeFactory nodeFactory()
           
 OnFlyCallGraph ofcg()
           
 PointsToSet reachingObjects(Local l, SootField f)
          Returns the set of objects pointed to by instance field f of the objects pointed to by l.
 void setOnFlyCallGraph(OnFlyCallGraph ofcg)
           
abstract  java.util.Iterator simpleInvSourcesIterator()
           
abstract  java.util.Iterator simpleSourcesIterator()
           
abstract  java.util.Iterator storeInvSourcesIterator()
           
abstract  java.util.Iterator storeSourcesIterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface soot.PointsToAnalysis
reachingObjects, reachingObjects, reachingObjects, reachingObjectsOfArrayElement
 

Field Detail

edgeQueue

protected ChunkedQueue edgeQueue

opts

protected AbstractSparkOptions opts

simple

protected java.util.Map simple

load

protected java.util.Map load

store

protected java.util.Map store

alloc

protected java.util.Map alloc

simpleInv

protected java.util.Map simpleInv

loadInv

protected java.util.Map loadInv

storeInv

protected java.util.Map storeInv

allocInv

protected java.util.Map allocInv

typeManager

protected AbstractTypeManager typeManager

maxFinishNumber

public int maxFinishNumber
Constructor Detail

AbstractPAG

public AbstractPAG(AbstractSparkOptions opts)
Method Detail

reachingObjects

public PointsToSet reachingObjects(Local l,
                                   SootField f)
Returns the set of objects pointed to by instance field f of the objects pointed to by l.

Specified by:
reachingObjects in interface PointsToAnalysis

makeAllocNode

public AllocNode makeAllocNode(java.lang.Object newExpr,
                               Type type,
                               SootMethod m)

makeStringConstantNode

public AllocNode makeStringConstantNode(java.lang.String s)

makeClassConstantNode

public AllocNode makeClassConstantNode(java.lang.String s)

allocNodeListener

public QueueReader allocNodeListener()

findGlobalVarNode

public GlobalVarNode findGlobalVarNode(java.lang.Object value)
Finds the GlobalVarNode for the variable value, or returns null.


findLocalVarNode

public LocalVarNode findLocalVarNode(java.lang.Object value)
Finds the LocalVarNode for the variable value, or returns null.


makeGlobalVarNode

public GlobalVarNode makeGlobalVarNode(java.lang.Object value,
                                       Type type)
Finds or creates the GlobalVarNode for the variable value, of type type.


makeLocalVarNode

public LocalVarNode makeLocalVarNode(java.lang.Object value,
                                     Type type,
                                     SootMethod method)
Finds or creates the LocalVarNode for the variable value, of type type.


findContextVarNode

public ContextVarNode findContextVarNode(java.lang.Object baseValue,
                                         java.lang.Object context)
Finds the ContextVarNode for base variable value and context context, or returns null.


makeContextVarNode

public ContextVarNode makeContextVarNode(java.lang.Object baseValue,
                                         Type baseType,
                                         java.lang.Object context,
                                         SootMethod method)
Finds or creates the ContextVarNode for base variable baseValue and context context, of type type.


makeContextVarNode

public ContextVarNode makeContextVarNode(LocalVarNode base,
                                         java.lang.Object context)
Finds or creates the ContextVarNode for base variable base and context context, of type type.


findLocalFieldRefNode

public FieldRefNode findLocalFieldRefNode(java.lang.Object baseValue,
                                          SparkField field)
Finds the FieldRefNode for base variable value and field field, or returns null.


findGlobalFieldRefNode

public FieldRefNode findGlobalFieldRefNode(java.lang.Object baseValue,
                                           SparkField field)
Finds the FieldRefNode for base variable value and field field, or returns null.


makeLocalFieldRefNode

public FieldRefNode makeLocalFieldRefNode(java.lang.Object baseValue,
                                          Type baseType,
                                          SparkField field,
                                          SootMethod method)
Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.


makeGlobalFieldRefNode

public FieldRefNode makeGlobalFieldRefNode(java.lang.Object baseValue,
                                           Type baseType,
                                           SparkField field)
Finds or creates the FieldRefNode for base variable baseValue and field field, of type type.


makeFieldRefNode

public FieldRefNode makeFieldRefNode(VarNode base,
                                     SparkField field)
Finds or creates the FieldRefNode for base variable base and field field, of type type.


findAllocDotField

public AllocDotField findAllocDotField(AllocNode an,
                                       SparkField field)
Finds the AllocDotField for base AllocNode an and field field, or returns null.


makeAllocDotField

public AllocDotField makeAllocDotField(AllocNode an,
                                       SparkField field)
Finds or creates the AllocDotField for base variable baseValue and field field, of type t.


doAddSimpleEdge

public abstract boolean doAddSimpleEdge(VarNode from,
                                        VarNode to)

addSimpleEdge

public boolean addSimpleEdge(VarNode from,
                             VarNode to)

doAddStoreEdge

public abstract boolean doAddStoreEdge(VarNode from,
                                       FieldRefNode to)

addStoreEdge

public boolean addStoreEdge(VarNode from,
                            FieldRefNode to)

doAddLoadEdge

public abstract boolean doAddLoadEdge(FieldRefNode from,
                                      VarNode to)

addLoadEdge

public boolean addLoadEdge(FieldRefNode from,
                           VarNode to)

doAddAllocEdge

public abstract boolean doAddAllocEdge(AllocNode from,
                                       VarNode to)

addAllocEdge

public boolean addAllocEdge(AllocNode from,
                            VarNode to)

addEdge

public final boolean addEdge(Node from,
                             Node to)
Adds an edge to the graph, returning false if it was already there.


edgeReader

public QueueReader edgeReader()

getNumAllocNodes

public int getNumAllocNodes()

getTypeManager

public AbstractTypeManager getTypeManager()

setOnFlyCallGraph

public void setOnFlyCallGraph(OnFlyCallGraph ofcg)

getOnFlyCallGraph

public OnFlyCallGraph getOnFlyCallGraph()

ofcg

public OnFlyCallGraph ofcg()

addDereference

public void addDereference(VarNode base)
Adds the base of a dereference to the list of dereferenced variables.


getDereferences

public java.util.List getDereferences()
Returns list of dereferences variables.


getNodeTags

public java.util.Map getNodeTags()

getSetFactory

public P2SetFactory getSetFactory()

simpleSourcesIterator

public abstract java.util.Iterator simpleSourcesIterator()

allocSourcesIterator

public abstract java.util.Iterator allocSourcesIterator()

storeSourcesIterator

public abstract java.util.Iterator storeSourcesIterator()

loadSourcesIterator

public abstract java.util.Iterator loadSourcesIterator()

simpleInvSourcesIterator

public abstract java.util.Iterator simpleInvSourcesIterator()

allocInvSourcesIterator

public abstract java.util.Iterator allocInvSourcesIterator()

storeInvSourcesIterator

public abstract java.util.Iterator storeInvSourcesIterator()

loadInvSourcesIterator

public abstract java.util.Iterator loadInvSourcesIterator()

getAllocNodeNumberer

public Numberer getAllocNodeNumberer()

getVarNodeNumberer

public Numberer getVarNodeNumberer()

getFieldRefNodeNumberer

public Numberer getFieldRefNodeNumberer()

getAllocDotFieldNodeNumberer

public Numberer getAllocDotFieldNodeNumberer()

getOpts

public AbstractSparkOptions getOpts()
Returns SparkOptions for this graph.


addCallTarget

public final void addCallTarget(Edge e)

addCallTarget

public final void addCallTarget(AbstractMethodPAG srcmpag,
                                AbstractMethodPAG tgtmpag,
                                Stmt s,
                                java.lang.Object srcContext,
                                java.lang.Object tgtContext)
Adds method target as a possible target of the invoke expression in s. If target is null, only creates the nodes for the call site, without actually connecting them to any target method.


addToMap

protected boolean addToMap(java.util.Map m,
                           Node key,
                           Node value)

nodeFactory

public GlobalNodeFactory nodeFactory()