Class FallbackContextInterpreter
- java.lang.Object
-
- com.ibm.wala.ipa.callgraph.propagation.cfa.FallbackContextInterpreter
-
- All Implemented Interfaces:
CHAContextInterpreter
,RTAContextInterpreter
,SSAContextInterpreter
public class FallbackContextInterpreter extends Object implements SSAContextInterpreter
This ContextInterpreter can be used when using another WALA frontend than the shrike frontend. WALA's standard ContextInterpreters, like e.g. DefaultSSAInterpreter delegate to CodeScanner, which assumes, that the provided methods are instances of shrike classes. When using these ContextInterpreter with another frontend than shrike, this leads to ClassCastExceptions. This class can be used to work around this issue. It delegates to a given ContextInterpreter, if the CGNode's IMethod is a Shrike class. Otherwise, it retrieves the required information from the CGNode's IR, which should always work.
-
-
Constructor Summary
Constructors Constructor Description FallbackContextInterpreter(SSAContextInterpreter shrikeCI)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ControlFlowGraph<SSAInstruction,ISSABasicBlock>
getCFG(CGNode n)
DefUse
getDU(CGNode node)
IR
getIR(CGNode node)
int
getNumberOfStatements(CGNode node)
Iterator<CallSiteReference>
iterateCallSites(CGNode node)
Iterator<FieldReference>
iterateFieldsRead(CGNode node)
Iterator<FieldReference>
iterateFieldsWritten(CGNode node)
Iterator<NewSiteReference>
iterateNewSites(CGNode node)
boolean
recordFactoryType(CGNode node, IClass klass)
record that the "factory" method of a node should be interpreted to allocate a particular class.boolean
understands(CGNode node)
Does this object understand the given method? The caller had better check this before inquiring on other properties.
-
-
-
Constructor Detail
-
FallbackContextInterpreter
public FallbackContextInterpreter(SSAContextInterpreter shrikeCI)
-
-
Method Detail
-
iterateNewSites
public Iterator<NewSiteReference> iterateNewSites(CGNode node)
- Specified by:
iterateNewSites
in interfaceRTAContextInterpreter
- Returns:
- an Iterator of the types that may be allocated by a given method in a given context.
-
iterateFieldsRead
public Iterator<FieldReference> iterateFieldsRead(CGNode node)
- Specified by:
iterateFieldsRead
in interfaceRTAContextInterpreter
- Returns:
- iterator of FieldReference
-
iterateFieldsWritten
public Iterator<FieldReference> iterateFieldsWritten(CGNode node)
- Specified by:
iterateFieldsWritten
in interfaceRTAContextInterpreter
- Returns:
- iterator of FieldReference
-
iterateCallSites
public Iterator<CallSiteReference> iterateCallSites(CGNode node)
- Specified by:
iterateCallSites
in interfaceCHAContextInterpreter
- Returns:
- an Iterator of the call statements that may execute in a given method for a given context
-
recordFactoryType
public boolean recordFactoryType(CGNode node, IClass klass)
Description copied from interface:RTAContextInterpreter
record that the "factory" method of a node should be interpreted to allocate a particular class. TODO: this is a little ugly, is there a better place to move this?- Specified by:
recordFactoryType
in interfaceRTAContextInterpreter
- Returns:
- true iff a NEW type was recorded, false if the type was previously recorded.
-
understands
public boolean understands(CGNode node)
Description copied from interface:CHAContextInterpreter
Does this object understand the given method? The caller had better check this before inquiring on other properties.- Specified by:
understands
in interfaceCHAContextInterpreter
-
getIR
public IR getIR(CGNode node)
- Specified by:
getIR
in interfaceSSAContextInterpreter
- Returns:
- the IR that models the method context, or null if it's an unmodelled native method
-
getDU
public DefUse getDU(CGNode node)
- Specified by:
getDU
in interfaceSSAContextInterpreter
- Returns:
- DefUse for the IR that models the method context, or null if it's an unmodelled native method
-
getNumberOfStatements
public int getNumberOfStatements(CGNode node)
- Specified by:
getNumberOfStatements
in interfaceSSAContextInterpreter
- Returns:
- the number of the statements in the IR, or -1 if it's an unmodelled native method.
-
getCFG
public ControlFlowGraph<SSAInstruction,ISSABasicBlock> getCFG(CGNode n)
- Specified by:
getCFG
in interfaceSSAContextInterpreter
-
-