com.ibm.wala.ipa.callgraph.propagation.cfa
Class ContainerContextSelector

java.lang.Object
  extended by com.ibm.wala.ipa.callgraph.propagation.cfa.ContainerContextSelector
All Implemented Interfaces:
ContextSelector

public class ContainerContextSelector
extends java.lang.Object
implements ContextSelector

This context selector returns a context customized for the instancekey of the receiver if


Field Summary
static Atom arraycopyAtom
           
static TypeReference JavaLangSystem
           
static MemberReference synthArraycopy
           
static TypeReference SyntheticSystem
           
 
Constructor Summary
ContainerContextSelector(ClassHierarchy cha, ZeroXInstanceKeys delegate)
           
 
Method Summary
 boolean allSitesDispatchIdentically(CGNode node, CallSiteReference site)
           
 boolean contextIsIrrelevant(CGNode node, CallSiteReference site)
           
static CGNode findNodeRecursiveMatchingContext(IMethod M, Context C)
          This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M.
static Context findRecursiveMatchingContext(IMethod M, Context C)
          This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M.
static Context findRecursiveMatchingContext(IMethod M, Context C, InstanceKey receiver)
          This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C a) includes the method M.
 int getBoundOnNumberOfTargets(CGNode caller, CallSiteReference site, IMethod targetMethod)
           
 Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey receiver)
          Given a call site, returns the Context in which the callee should be evaluated.
protected  ClassHierarchy getClassHierarchy()
           
static boolean isArrayCopy(MemberReference m)
           
protected  boolean isContainer(IClass C)
           
 boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey receiver)
           
 void setWarnings(WarningSet newWarnings)
          Bind this object to a new object to track warnings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SyntheticSystem

public static final TypeReference SyntheticSystem

JavaLangSystem

public static final TypeReference JavaLangSystem

arraycopyAtom

public static final Atom arraycopyAtom

synthArraycopy

public static final MemberReference synthArraycopy
Constructor Detail

ContainerContextSelector

public ContainerContextSelector(ClassHierarchy cha,
                                ZeroXInstanceKeys delegate)
Parameters:
cha -
delegate -
Method Detail

getCalleeTarget

public Context getCalleeTarget(CGNode caller,
                               CallSiteReference site,
                               IMethod callee,
                               InstanceKey receiver)
Description copied from interface: ContextSelector
Given a call site, returns the Context in which the callee should be evaluated.

Specified by:
getCalleeTarget in interface ContextSelector
site - description of the call site
Returns:
the Context in which the callee should be evaluated, or null if no information is available.

isArrayCopy

public static boolean isArrayCopy(MemberReference m)

findRecursiveMatchingContext

public static Context findRecursiveMatchingContext(IMethod M,
                                                   Context C,
                                                   InstanceKey receiver)
This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C a) includes the method M. or b) includes the method in which the receiver was allocated

Returns:
the matching context if found, null otherwise

findNodeRecursiveMatchingContext

public static CGNode findNodeRecursiveMatchingContext(IMethod M,
                                                      Context C)
This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N. Else return findRecursiveMatchingContext(M, N.context) Else return null


findRecursiveMatchingContext

public static Context findRecursiveMatchingContext(IMethod M,
                                                   Context C)
This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N.context. Else return findRecursiveMatchingContext(M, N.context) Else return null


getBoundOnNumberOfTargets

public int getBoundOnNumberOfTargets(CGNode caller,
                                     CallSiteReference site,
                                     IMethod targetMethod)
Specified by:
getBoundOnNumberOfTargets in interface ContextSelector
Returns:
a bound on the number of contexts that might be created for this target. -1 if no bound is known.

mayUnderstand

public boolean mayUnderstand(CGNode caller,
                             CallSiteReference site,
                             IMethod targetMethod,
                             InstanceKey receiver)
Specified by:
mayUnderstand in interface ContextSelector
receiver - the instance dispatched on. null means "any possible instance"
Returns:
true iff this object may understand how to select a context for the given target

isContainer

protected boolean isContainer(IClass C)
Parameters:
C -
Returns:
true iff C is a container class

setWarnings

public void setWarnings(WarningSet newWarnings)
Description copied from interface: ContextSelector
Bind this object to a new object to track warnings

Specified by:
setWarnings in interface ContextSelector

contextIsIrrelevant

public boolean contextIsIrrelevant(CGNode node,
                                   CallSiteReference site)
Specified by:
contextIsIrrelevant in interface ContextSelector
Returns:
true iff this context selector will always return the same context for a given call site, regardless of the receiver object

getClassHierarchy

protected ClassHierarchy getClassHierarchy()
Returns:
Returns the cha.

allSitesDispatchIdentically

public boolean allSitesDispatchIdentically(CGNode node,
                                           CallSiteReference site)
Specified by:
allSitesDispatchIdentically in interface ContextSelector
Returns:
true iff \forAll n \in nodes, \forAll s \in sites with this declaredTarget, the set of targets is the same