Class ContainerContextSelector
- java.lang.Object
-
- com.ibm.wala.ipa.callgraph.propagation.cfa.ContainerContextSelector
-
- All Implemented Interfaces:
ContextSelector
public class ContainerContextSelector extends Object implements ContextSelector
This context selector returns a context customized for theInstanceKey
of the receiver if- receiver is a container, or was allocated in a node whose context was a
ReceiverInstanceContext
, and the type is interesting according to a delegateZeroXInstanceKeys
-
-
Field Summary
Fields Modifier and Type Field Description static Atom
arraycopyAtom
static TypeReference
JavaUtilHashtable
static MethodReference
synthArraycopy
static TypeReference
SyntheticSystem
-
Constructor Summary
Constructors Constructor Description ContainerContextSelector(IClassHierarchy cha, ZeroXInstanceKeys delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Context
getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] keys)
Given a calling node and a call site, returns the Context in which the callee should be evaluated.protected IClassHierarchy
getClassHierarchy()
IntSet
getRelevantParameters(CGNode caller, CallSiteReference site)
Given a calling node and a call site, return the set of parameters based on which this selector may choose to specialize contexts.static boolean
isArrayCopyingMethod(MethodReference m)
Does m represent a library method that copies arrays?protected boolean
isContainer(IClass C)
static boolean
isWellKnownStaticFactory(MethodReference m)
Does m represent a static factory method we know about from the standard libraries, that we usually wish to model with one level of call-string context?boolean
mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey receiver)
-
-
-
Field Detail
-
SyntheticSystem
public static final TypeReference SyntheticSystem
-
JavaUtilHashtable
public static final TypeReference JavaUtilHashtable
-
arraycopyAtom
public static final Atom arraycopyAtom
-
synthArraycopy
public static final MethodReference synthArraycopy
-
-
Constructor Detail
-
ContainerContextSelector
public ContainerContextSelector(IClassHierarchy cha, ZeroXInstanceKeys delegate)
- Parameters:
cha
- governing class hierarchydelegate
- object which determines which classes are "interesting"
-
-
Method Detail
-
getCalleeTarget
public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, InstanceKey[] keys)
Description copied from interface:ContextSelector
Given a calling node and a call site, returns the Context in which the callee should be evaluated.- Specified by:
getCalleeTarget
in interfaceContextSelector
- Parameters:
caller
- the node containing the call sitesite
- description of the call sitekeys
- the abstract objects (InstanceKeys) of parameters of interest to the selector- Returns:
- the Context in which the callee should be evaluated, or null if no information is available.
-
isWellKnownStaticFactory
public static boolean isWellKnownStaticFactory(MethodReference m)
Does m represent a static factory method we know about from the standard libraries, that we usually wish to model with one level of call-string context?
-
isArrayCopyingMethod
public static boolean isArrayCopyingMethod(MethodReference m)
Does m represent a library method that copies arrays?
-
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
-
mayUnderstand
public boolean mayUnderstand(CGNode caller, CallSiteReference site, IMethod targetMethod, InstanceKey receiver)
-
isContainer
protected boolean isContainer(IClass C)
- Returns:
- true iff C is a container class
-
getClassHierarchy
protected IClassHierarchy getClassHierarchy()
-
getRelevantParameters
public IntSet getRelevantParameters(CGNode caller, CallSiteReference site)
Description copied from interface:ContextSelector
Given a calling node and a call site, return the set of parameters based on which this selector may choose to specialize contexts.- Specified by:
getRelevantParameters
in interfaceContextSelector
- Parameters:
caller
- the calling nodesite
- the specific call site- Returns:
- the set of parameters of interest
-
-