public class VolatileMethodSummary extends Object
getMethodSummary()-Method.
It extends the MethodSummarys capabilities by the functions:
* getStatementAt(int)
* #getStatementsAfter(int)
* reserveProgramCounters(int)
* allowReserved(boolean)com.ibm.wala.dalvik.ssa.AndroidModelInstructionFectory,
com.ibm.wala.dalvik.ipa.callgraph.impl.DexFakeRootMethod,
MethodSummary| Constructor and Description |
|---|
VolatileMethodSummary(MethodSummary summary) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstant(Integer vn,
ConstantValue value)
Assigns a new Constant to a SSA-Value.
|
void |
addPoison(String reason)
Adds posion to the function.
|
void |
addStatement(SSAInstruction statement)
Adds a statement to the MethodSummary.
|
boolean |
allowReserved(boolean enable)
(Dis-)allows the usage of reserved ProgramCounters.
|
Map<Integer,ConstantValue> |
getConstants()
Retrieves a mapping from SSA-Number to a constant.
|
Map<Integer,Atom> |
getLocalNames()
A mapping from SSA-Values to Variable-names.
|
MemberReference |
getMethod()
Retrieve the Method this Summary implements.
|
MethodSummary |
getMethodSummary()
Generates the MethodSummary and locks class.
|
int |
getNextProgramCounter()
Gets you a non-reserved ProgramCounter you can write to.
|
int |
getNumberOfParameters()
Get the count of parameters of the Method this Summary implements.
|
TypeReference |
getParameterType(int i)
Gets you the TypeReference of a parameter.
|
String |
getPoison()
Retrieves the poison set using
addPoison(java.lang.String) |
byte |
getPoisonLevel()
Retrieves the value of Poison-Level.
|
TypeReference |
getReturnType()
Retrieves the return-type of the Function whose body this Summary implements.
|
SSAInstruction |
getStatementAt(int programCounter) |
SSAInstruction[] |
getStatements()
Get all statements added to the Summary.
|
boolean |
hasPoison()
Returns if Poison has been added using
addPoison(java.lang.String). |
boolean |
isFactory()
Returns if the implemented method is a factory.
|
boolean |
isFree(int programCounter)
Returns if the ProgramCounter is writable.
|
boolean |
isNative()
Return if the implemented method is a native one (which it shouldn't be).
|
boolean |
isReserved(int programCounter)
Returns if the ProgramCounter is reserved.
|
boolean |
isStatic()
Return if the implemented method is static.
|
boolean |
isUsed(int programCounter)
Not exactly dual to
#isFree(boolean). |
boolean |
overwriteStatement(SSAInstruction statement)
Like {@link addStatement(SSAInstructionWithPC extends SSAInstruction>) but may replace an existing one.
|
void |
reserveProgramCounters(int count)
Reserves an amount of ProgramCounters for later use.
|
void |
setFactory(boolean b)
Set the value returned by
#getFactory() |
void |
setLocalName(int number,
String name)
Optionally add a name for a local variable.
|
void |
setLocalNames(Map<Integer,Atom> merge)
Set localNames merges with existing names.
|
void |
setPoisonLevel(byte b)
Set the value returned by
getPoisonLevel() |
void |
setStatic(boolean b)
Set the value returned by
#getStatic() |
String |
toString()
Generates a String-Representation of an instance of the class.
|
public VolatileMethodSummary(MethodSummary summary)
summary - a "real" summary methods get added to.IllegalArgumentException - if this summary is null or not emptypublic SSAInstruction getStatementAt(int programCounter)
programCounter - the ProgramCounter to retrieve the Instruction fromIllegalArgumentException - if the ProgramCounter is negativepublic void reserveProgramCounters(int count)
allowReserved(boolean).count - The amount of ProgramCounters to reserve ongoing from the
current ProgramCounterIllegalArgumentException - if the count is negative (a count of zero
is however ok)public boolean allowReserved(boolean enable)
enable - A value of true allows the usage of all reserved ProgramCounterspublic boolean isReserved(int programCounter)
programCounter - the ProgramCounter in questionIllegalArgumentException - if the ProgramCounter is negativepublic boolean isFree(int programCounter)
allowReserved(boolean).programCounter - the ProgramCounter in questionIllegalArgumentException - if the ProgramCounter is negativepublic boolean isUsed(int programCounter)
#isFree(boolean).
Returns whether an instruction is located at ProgramCounter. Thus it is a shortcut
to getStatementAt(int) != null.
It is not the exact dual to #isFree(boolean) as it does not consider reserved
ProgramCounters.
programCounter - the ProgramCounter in questionIllegalArgumentException - if the ProgramCounter is negativepublic boolean overwriteStatement(SSAInstruction statement)
statement - The statement to add without care of overwritingIllegalStateException - if you may not write to the ProgramCounter due to
the setting of allowReserved(boolean) or getMethodSummary() has
been called and thus this summary got locked.NullPointerException - if statement is nullIllegalArgumentException - if the statement has set an invalid ProgramCounterpublic MethodSummary getMethodSummary()
IllegalStateException - if you altered the referenced (by constructor) summarypublic void addStatement(SSAInstruction statement)
statement - The statement to be addedIllegalStateException - if you may not write to the ProgramCounter due to
the setting of allowReserved(boolean) or getMethodSummary() has
been called and thus this summary got locked.NullPointerException - if statement is nullIllegalArgumentException - if the statement has set an invalid ProgramCounter or
if there is already a statement at the statements iindex. In this case you can use
#overwritetatement(SSAInstruction).public void setLocalName(int number,
String name)
public void setLocalNames(Map<Integer,Atom> merge)
public void addConstant(Integer vn, ConstantValue value)
IllegalStateException - if you redefine a constant or use the number of an existent
SSA-VariableIllegalArgumentException - if value is null or negativepublic void addPoison(String reason)
public Map<Integer,ConstantValue> getConstants()
addConstant(java.lang.Integer, ConstantValue).
A call to this function gets passed directly to the internal MethodSummary.public MemberReference getMethod()
public int getNextProgramCounter()
#isUsed(ProgramCounter))
holds. Thus it will _not_ give you a ProgramCounter which is reserved even if you enabled
writing to reserved ProgramCounters using allowReserved(boolean)! You'll have to
keep track of them on your own.public int getNumberOfParameters()
public TypeReference getParameterType(int i)
IllegalArgumentException - if the parameter is zero or negativeArrayIndexOutOfBoundsException - if the parameter is to largepublic String getPoison()
addPoison(java.lang.String)public byte getPoisonLevel()
public TypeReference getReturnType()
public SSAInstruction[] getStatements()
public boolean hasPoison()
addPoison(java.lang.String).
This call gets passed directly to the internal MethodSummary.public boolean isFactory()
public boolean isNative()
public boolean isStatic()
public void setFactory(boolean b)
#getFactory()IllegalStateException - if summary was lockedpublic void setPoisonLevel(byte b)
getPoisonLevel()IllegalStateException - if summary was lockedpublic void setStatic(boolean b)
#getStatic()IllegalStateException - if summary was lockedCopyright © 2015. All rights reserved.