soot.jimple.spark.pag
Class PAG

java.lang.Object
  |
  +--soot.jimple.spark.pag.PAG
All Implemented Interfaces:
PointsToAnalysis

public class PAG
extends java.lang.Object
implements PointsToAnalysis

Pointer assignment graph.


Field Summary
protected  java.util.Map alloc
           
protected  java.util.Map allocInv
           
protected  java.util.ArrayList dereferences
           
protected static Node[] EMPTY_NODE_ARRAY
           
protected  java.util.Map load
           
protected  java.util.Map loadInv
           
protected  int nextAllocNodeId
           
protected  int nextNodeId
           
protected  OnFlyCallGraph ofcg
           
protected  SparkOptions opts
           
protected  P2SetFactory setFactory
           
protected  java.util.Map simple
           
protected  java.util.Map simpleInv
           
protected static boolean somethingMerged
           
protected  java.util.Map store
           
protected  java.util.Map storeInv
           
protected  TypeManager typeManager
           
protected  java.util.Map valToAllocNode
           
protected  java.util.Map valToVarNode
           
 
Fields inherited from interface soot.jimple.spark.PointsToAnalysis
ARRAY_ELEMENTS_NODE, CAST_NODE, EXCEPTION_NODE, RETURN_NODE, RETURN_STRING_CONSTANT_NODE, STRING_ARRAY_NODE, STRING_ARRAY_NODE_LOCAL, STRING_NODE, STRING_NODE_LOCAL, THIS_NODE, THROW_NODE
 
Constructor Summary
PAG(SparkOptions opts)
           
 
Method Summary
 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.
protected  boolean addToMap(java.util.Map m, Node key, Node value)
           
 Node[] allocInvLookup(VarNode key)
           
 java.util.Set allocInvSources()
           
 Node[] allocLookup(AllocNode key)
           
 java.util.Set allocSources()
           
 java.util.Set allVarNodes()
           
 void cleanUpMerges()
           
 AllocDotField findAllocDotField(AllocNode an, SparkField field)
          Finds the AllocDotField for base AllocNode an and field field, or returns null.
 FieldRefNode findFieldRefNode(java.lang.Object baseValue, SparkField field)
          Finds the FieldRefNode for base variable value and field field, or returns null.
 VarNode findVarNode(java.lang.Object value)
          Finds the VarNode for the variable value, or returns null.
 java.util.List getDereferences()
          Returns list of dereferences variables.
 int getNumAllocNodes()
           
 OnFlyCallGraph getOnFlyCallGraph()
           
 SparkOptions getOpts()
          Returns SparkOptions for this graph.
 P2SetFactory getSetFactory()
           
 TypeManager getTypeManager()
           
 Node[] loadInvLookup(VarNode key)
           
 java.util.Set loadInvSources()
           
 Node[] loadLookup(FieldRefNode key)
           
 java.util.Set loadSources()
           
protected  Node[] lookup(java.util.Map m, java.lang.Object key)
           
 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)
          Finds or creates the AllocNode for the new expression newExpr, of type type.
 FieldRefNode makeFieldRefNode(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.
 FieldRefNode makeFieldRefNode(VarNode base, SparkField field)
          Finds or creates the FieldRefNode for base variable base and field field, of type type.
 VarNode makeVarNode(java.lang.Object value, Type type, SootMethod method)
          Finds or creates the VarNode for the variable value, of type type.
 PointsToSet reachingObjects(SootMethod method, Stmt stmt, Local l)
          Returns the set of objects reaching variable l before stmt in method.
 void setOnFlyCallGraph(OnFlyCallGraph ofcg)
           
 Node[] simpleInvLookup(VarNode key)
           
 java.util.Set simpleInvSources()
           
 Node[] simpleLookup(VarNode key)
           
 java.util.Set simpleSources()
           
 Node[] storeInvLookup(FieldRefNode key)
           
 java.util.Set storeInvSources()
           
 Node[] storeLookup(VarNode key)
           
 java.util.Set storeSources()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nextNodeId

protected int nextNodeId

nextAllocNodeId

protected int nextAllocNodeId

opts

protected SparkOptions 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

EMPTY_NODE_ARRAY

protected static final Node[] EMPTY_NODE_ARRAY

valToVarNode

protected java.util.Map valToVarNode

valToAllocNode

protected java.util.Map valToAllocNode

setFactory

protected P2SetFactory setFactory

ofcg

protected OnFlyCallGraph ofcg

somethingMerged

protected static boolean somethingMerged

dereferences

protected java.util.ArrayList dereferences

typeManager

protected TypeManager typeManager
Constructor Detail

PAG

public PAG(SparkOptions opts)
Method Detail

reachingObjects

public PointsToSet reachingObjects(SootMethod method,
                                   Stmt stmt,
                                   Local l)
Returns the set of objects reaching variable l before stmt in method.

Specified by:
reachingObjects in interface PointsToAnalysis

getOpts

public SparkOptions getOpts()
Returns SparkOptions for this graph.


makeAllocNode

public AllocNode makeAllocNode(java.lang.Object newExpr,
                               Type type)
Finds or creates the AllocNode for the new expression newExpr, of type type.


findVarNode

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


makeVarNode

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


findFieldRefNode

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


makeFieldRefNode

public FieldRefNode makeFieldRefNode(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.


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.


addEdge

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


simpleLookup

public Node[] simpleLookup(VarNode key)

simpleInvLookup

public Node[] simpleInvLookup(VarNode key)

loadLookup

public Node[] loadLookup(FieldRefNode key)

loadInvLookup

public Node[] loadInvLookup(VarNode key)

storeLookup

public Node[] storeLookup(VarNode key)

storeInvLookup

public Node[] storeInvLookup(FieldRefNode key)

allocLookup

public Node[] allocLookup(AllocNode key)

allocInvLookup

public Node[] allocInvLookup(VarNode key)

simpleSources

public java.util.Set simpleSources()

allocSources

public java.util.Set allocSources()

storeSources

public java.util.Set storeSources()

loadSources

public java.util.Set loadSources()

simpleInvSources

public java.util.Set simpleInvSources()

allocInvSources

public java.util.Set allocInvSources()

storeInvSources

public java.util.Set storeInvSources()

loadInvSources

public java.util.Set loadInvSources()

allVarNodes

public java.util.Set allVarNodes()

getSetFactory

public P2SetFactory getSetFactory()

getNumAllocNodes

public int getNumAllocNodes()

getTypeManager

public TypeManager getTypeManager()

setOnFlyCallGraph

public void setOnFlyCallGraph(OnFlyCallGraph ofcg)

getOnFlyCallGraph

public OnFlyCallGraph getOnFlyCallGraph()

cleanUpMerges

public void cleanUpMerges()

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.


addToMap

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

lookup

protected Node[] lookup(java.util.Map m,
                        java.lang.Object key)