com.ibm.wala.ipa.callgraph.impl
Class DefaultContextSelector
java.lang.Object
com.ibm.wala.ipa.callgraph.impl.DefaultContextSelector
- All Implemented Interfaces:
- ContextSelector
public class DefaultContextSelector
- extends java.lang.Object
- implements ContextSelector
Default object to control context-insensitive context selection
|
Method Summary |
boolean |
allSitesDispatchIdentically(CGNode caller,
CallSiteReference site)
|
boolean |
contextIsIrrelevant(CGNode caller,
CallSiteReference site)
|
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. |
boolean |
mayUnderstand(CGNode caller,
CallSiteReference site,
IMethod targetMethod,
InstanceKey instance)
|
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 |
DefaultContextSelector
public DefaultContextSelector(IClassHierarchy cha,
MethodTargetSelector methodTargetSelector)
- Parameters:
cha - methodTargetSelector -
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.
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.
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 caller,
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
allSitesDispatchIdentically
public boolean allSitesDispatchIdentically(CGNode caller,
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
mayUnderstand
public boolean mayUnderstand(CGNode caller,
CallSiteReference site,
IMethod targetMethod,
InstanceKey instance)
- Specified by:
mayUnderstand in interface ContextSelector
instance - 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