Class FlatInstantiator
- java.lang.Object
-
- com.ibm.wala.dalvik.ipa.callgraph.androidModel.parameters.FlatInstantiator
-
- All Implemented Interfaces:
IInstantiator
- Direct Known Subclasses:
SpecializedInstantiator
public class FlatInstantiator extends Object implements IInstantiator
Add code to create an instance of a type in a synthetic method. This variant limits recursion depth.
-
-
Constructor Summary
Constructors Constructor Description FlatInstantiator(VolatileMethodSummary body, TypeSafeInstructionFactory instructionFactory, SSAValueManager pm, IClassHierarchy cha, MethodReference scope, AnalysisScope analysisScope)
FlatInstantiator(VolatileMethodSummary body, TypeSafeInstructionFactory instructionFactory, SSAValueManager pm, IClassHierarchy cha, MethodReference scope, AnalysisScope analysisScope, int maxDepth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCallCtor(SSAValue self, MethodReference ctor, List<SSAValue> ctorParams)
Add a call to the given constructor to the body.SSAValue
createInstance(TypeReference T, boolean asManaged, SSAValue.VariableKey key, Set<? extends SSAValue> seen)
Creates a new instance of type calling all that's necessary.int
createInstance(TypeReference type, Object... instantiatorArgs)
Satisfy the interface.
-
-
-
Constructor Detail
-
FlatInstantiator
public FlatInstantiator(VolatileMethodSummary body, TypeSafeInstructionFactory instructionFactory, SSAValueManager pm, IClassHierarchy cha, MethodReference scope, AnalysisScope analysisScope)
-
FlatInstantiator
public FlatInstantiator(VolatileMethodSummary body, TypeSafeInstructionFactory instructionFactory, SSAValueManager pm, IClassHierarchy cha, MethodReference scope, AnalysisScope analysisScope, int maxDepth)
-
-
Method Detail
-
createInstance
public SSAValue createInstance(TypeReference T, boolean asManaged, SSAValue.VariableKey key, Set<? extends SSAValue> seen)
Creates a new instance of type calling all that's necessary. If T is a class-type all its constructors are searched for the one found best suited (takes the least arguments, ...). New instances are created for all parameters, then the constructor is called. If T represents multiple types (is an interface, abstract class, ...) _all_ implementors of that type are instantiated After that they get Phi-ed together. If T is an array-type a new array of length 1 is generated.
-
addCallCtor
protected void addCallCtor(SSAValue self, MethodReference ctor, List<SSAValue> ctorParams)
Add a call to the given constructor to the body.- Parameters:
self
- the "this" to call the constructor onctor
- the constructor to callparams
- parameters to the ctor _without_ implicit this
-
createInstance
public int createInstance(TypeReference type, Object... instantiatorArgs)
Satisfy the interface.- Specified by:
createInstance
in interfaceIInstantiator
- Parameters:
type
- Type to generate an instance frominstantiatorArgs
- passed through utility functions- Returns:
- SSA-Number of the instance
-
-