public class AndroidModelParameterManager extends Object
However it does no allocations or Phi-Statements on its own. It just juggles with the numbers.
AbstractAndroidModel
,
DexFakeRootMethod
Constructor and Description |
---|
AndroidModelParameterManager(IInstantiationBehavior behaviour)
Setting the behaviour may be handy in the later model.
|
AndroidModelParameterManager(MethodReference mRef,
boolean isStatic) |
AndroidModelParameterManager(ParameterAccessor acc) |
Modifier and Type | Method and Description |
---|---|
List<Integer> |
getAllForPhi(TypeReference type) |
int |
getCurrent(TypeReference type)
Retreive the SSA-Number that is valid for a type in the current scope.
|
int |
getFree(TypeReference type)
Returns and registers a free SSA-Number to a Type.
|
int |
getSuper(TypeReference type)
Retreive the SSA-Number that is valid for a type in the super-ordinate scope.
|
int |
getUnallocated(TypeReference type)
Get an unused number to assign to.
|
int |
getUnmanaged()
Retreive a SSA-Value that is not under management.
|
void |
invalidate(TypeReference type) |
boolean |
isCreate(TypeReference type)
Shorthand for not(
isReuse(TypeReference) . |
boolean |
isReuse(TypeReference type)
Handed through to an IInstantiationBehavior if set in the constructor.
|
boolean |
isSeen(TypeReference type) |
boolean |
isSeen(TypeReference type,
boolean withSuper)
Return if the type is managed by this class.
|
boolean |
needsAllocation(TypeReference type)
Returns if an instance for that type needs to be allocated.
|
boolean |
needsPhi(TypeReference type)
Returns if a PhiInstruction (still) has to be added.
|
int |
scopeDown(boolean doesLoop)
Enter a subordinate scope.
|
int |
scopeUp()
Leave a subordinate scope.
|
void |
setAllocation(SSAValue val) |
void |
setAllocation(TypeReference type,
int ssaValue) |
void |
setAllocation(TypeReference type,
int ssaValue,
SSAInstruction setBy)
Register a variable _after_ allocation.
|
void |
setPhi(TypeReference type,
int ssaValue,
SSAInstruction setBy)
Register a Phi-Instruction _after_ added to the model.
|
String |
toString() |
public AndroidModelParameterManager(IInstantiationBehavior behaviour)
public AndroidModelParameterManager(MethodReference mRef, boolean isStatic)
public AndroidModelParameterManager(ParameterAccessor acc)
public void setAllocation(TypeReference type, int ssaValue, SSAInstruction setBy)
getUnallocated(com.ibm.wala.types.TypeReference)
. Then
assign it a value. And at last call this function.
You can however directly call the function if the type has not been seen before.type
- The type allocatedssaValue
- an unallocated SSA-Variable to assign the allocation tosetBy
- The instruction that set the valueIllegalStateException
- if you set more than one allocation for that type (TODO better check!)IllegalArgumentException
- if type is null or ssaValue is zero or negativepublic void setAllocation(TypeReference type, int ssaValue)
public void setAllocation(SSAValue val)
public void setPhi(TypeReference type, int ssaValue, SSAInstruction setBy)
type
- the type the Phi-Instruction setsssaValue
- the number the SSA-Instruction assignes tosetBy
- the Phi-Instruction itself - may be nullIllegalArgumentException
- if you assign to a number requested using
getFree(TypeReference)
but types mismach.IllegalStateException
- if you forgot to close some Phispublic int getFree(TypeReference type)
IllegalArgumentException
- if type is nullpublic int getUnallocated(TypeReference type)
IllegalStateException
- if there is already an unallocated variable of that typeIllegalArgumentException
- if type is nullpublic int getUnmanaged()
public int getCurrent(TypeReference type)
IllegalStateException
- if no number is assignableIllegalArgumentException
- if type was not seen before or is nullpublic int getSuper(TypeReference type)
IllegalStateException
- if no number is assignableIllegalArgumentException
- if type was not seen before or is nullpublic List<Integer> getAllForPhi(TypeReference type)
IllegalArgumentException
- if type was not seen before or is nullpublic boolean isSeen(TypeReference type, boolean withSuper)
withSuper
- when true return true if a managed key may be cast to type,
when false type has to match exactlytype
- the type in questionIllegalArgumentException
- if type is nullpublic boolean isSeen(TypeReference type)
public boolean needsAllocation(TypeReference type)
IllegalArgumentException
- if type is nullpublic boolean needsPhi(TypeReference type)
IllegalArgumentException
- if type is null or has not been seen beforepublic void invalidate(TypeReference type)
IllegalArgumentException
- if type was not seen before or is nullpublic int scopeDown(boolean doesLoop)
This function influences the placement of Phi-Functions. Thus if you don't change values you don't have to call it.
doesLoop
- set to true if the scope is introduced for a looppublic int scopeUp()
IllegalStateException
- if already at top levelpublic boolean isReuse(TypeReference type)
IllegalStateExcpetion
- if AndroidModelParameterManager was constructed without an IInstanciationBehaviorpublic boolean isCreate(TypeReference type)
isReuse(TypeReference)
.IllegalStateExcpetion
- if AndroidModelParameterManager was constructed without an IInstanciationBehavior