com.ibm.wala.cast.ipa.callgraph
Class CrossLanguageContextSelector
java.lang.Object
com.ibm.wala.cast.ipa.callgraph.CrossLanguageContextSelector
- All Implemented Interfaces:
- ContextSelector
public class CrossLanguageContextSelector
- extends java.lang.Object
- implements ContextSelector
A ContextSelector implementation adapted to work for analysi across
multiple languages. This context selector delegates to one of several
child selectors based on the language of the code body for which a
context is being selected.
This provides a convenient way to integrate multiple, lanuage-specific
specialized context policies---such as the ones used for clone() in
Java and runtime primitives in JavaScript.
|
Method Summary |
boolean |
allSitesDispatchIdentically(CGNode node,
CallSiteReference site)
|
boolean |
contextIsIrrelevant(CGNode node,
CallSiteReference site)
|
int |
getBoundOnNumberOfTargets(CGNode caller,
CallSiteReference reference,
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 |
CrossLanguageContextSelector
public CrossLanguageContextSelector(java.util.Map languageSelectors)
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.
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
getBoundOnNumberOfTargets
public int getBoundOnNumberOfTargets(CGNode caller,
CallSiteReference reference,
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 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
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
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