public abstract class Body extends AbstractHost implements java.io.Serializable
GrimpBody
,
JimpleBody
,
BafBody
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Chain<Local> |
localChain
The chain of locals for this Body.
|
protected SootMethod |
method
The method associated with this Body.
|
protected Chain<Trap> |
trapChain
The chain of traps for this Body.
|
protected PatchingChain<Unit> |
unitChain
The chain of units for this Body.
|
col, line, mTagList
Modifier | Constructor and Description |
---|---|
protected |
Body()
Creates an extremely empty Body.
|
protected |
Body(SootMethod m)
Creates a Body associated to the given method.
|
Modifier and Type | Method and Description |
---|---|
void |
checkInit() |
abstract java.lang.Object |
clone()
Creates a deep copy of this Body.
|
java.util.List<UnitBox> |
getAllUnitBoxes()
Returns the result of iterating through all Units in this body
and querying them for their UnitBoxes.
|
java.util.List<ValueBox> |
getDefBoxes()
Returns the result of iterating through all Units in this
body and querying them for ValueBoxes defined.
|
int |
getLocalCount()
Returns the number of locals declared in this body.
|
Chain<Local> |
getLocals()
Returns a backed chain of the locals declared in this Body.
|
SootMethod |
getMethod()
Returns the method associated with this Body.
|
long |
getModificationCount() |
Local |
getParameterLocal(int i)
Return LHS of the first identity stmt assigning from \@parameter i.
|
java.util.List<Local> |
getParameterLocals()
Get all the LHS of the identity statements assigning from parameter references.
|
java.util.List<Value> |
getParameterRefs()
Returns the list of parameter references used in this body.
|
Local |
getThisLocal()
Return LHS of the first identity stmt assigning from \@this.
|
Chain<Trap> |
getTraps()
Returns a backed view of the traps found in this Body.
|
java.util.List<UnitBox> |
getUnitBoxes(boolean branchTarget)
If branchTarget is true, returns the result of iterating
through all branching Units in this body and querying them for
their UnitBoxes.
|
PatchingChain<Unit> |
getUnits()
Returns the Chain of Units that make up this body.
|
java.util.List<ValueBox> |
getUseAndDefBoxes()
Returns a list of boxes corresponding to Values
either used or defined in any unit of this Body.
|
java.util.List<ValueBox> |
getUseBoxes()
Returns the result of iterating through all Units in this
body and querying them for ValueBoxes used.
|
java.util.Map<java.lang.Object,java.lang.Object> |
importBodyContentsFrom(Body b)
Copies the contents of the given Body into this one.
|
protected void |
runValidation(BodyValidator validator) |
void |
setMethod(SootMethod method)
Sets the method associated with this Body.
|
java.lang.String |
toString() |
void |
validate()
Verifies a few sanity conditions on the contents on this body.
|
void |
validate(java.util.List<ValidationException> exceptionList)
Validates the jimple body and saves a list of all validation errors
|
void |
validateLocals()
Verifies that each Local of getUseAndDefBoxes() is in this body's locals Chain.
|
void |
validateTraps()
Verifies that the begin, end and handler units of each trap are in this body.
|
void |
validateUnitBoxes()
Verifies that the UnitBoxes of this Body all point to a Unit contained within this body.
|
void |
validateUses()
Verifies that each use in this Body has a def.
|
void |
validateValueBoxes()
Verifies that a ValueBox is not used in more than one place.
|
addAllTagsOf, addTag, getJavaSourceStartColumnNumber, getJavaSourceStartLineNumber, getTag, getTags, hasTag, removeAllTags, removeTag
protected transient SootMethod method
protected PatchingChain<Unit> unitChain
protected Body(SootMethod m)
protected Body()
public abstract java.lang.Object clone()
clone
in class java.lang.Object
public SootMethod getMethod()
public void setMethod(SootMethod method)
method
- the method that owns this body.public int getLocalCount()
public java.util.Map<java.lang.Object,java.lang.Object> importBodyContentsFrom(Body b)
protected void runValidation(BodyValidator validator)
public void validate()
public void validate(java.util.List<ValidationException> exceptionList)
exceptionList
- the list of validation errorspublic void validateValueBoxes()
public void validateLocals()
public void validateTraps()
public void validateUnitBoxes()
public void validateUses()
public Chain<Local> getLocals()
public Local getThisLocal()
public Local getParameterLocal(int i)
public java.util.List<Local> getParameterLocals()
getMethod().getParameterCount()
with all elements ordered as per the parameter index.java.lang.RuntimeException
- if a parameterref is missingpublic java.util.List<Value> getParameterRefs()
null
entries for parameters not referenced in the body.
The returned list is of fixed size.public PatchingChain<Unit> getUnits()
PatchingChain
,
Unit
public java.util.List<UnitBox> getAllUnitBoxes()
This method is typically used for pointer patching, eg when the unit chain is cloned.
UnitBox
,
getUnitBoxes(boolean)
,
Unit.getUnitBoxes()
,
UnitBoxOwner.getUnitBoxes()
public java.util.List<UnitBox> getUnitBoxes(boolean branchTarget)
If branchTarget is false, returns the result of iterating through the non-branching Units in this body and querying them for their UnitBoxes. Any such UnitBoxes (typically from PhiExpr) contain a Unit that indicates the end of a CFG block.
UnitBox
,
getAllUnitBoxes()
,
Unit.getUnitBoxes()
,
UnitBoxOwner.getUnitBoxes()
public java.util.List<ValueBox> getUseBoxes()
Value
,
Unit.getUseBoxes()
,
ValueBox
,
Value
public java.util.List<ValueBox> getDefBoxes()
Value
,
Unit.getDefBoxes()
,
ValueBox
,
Value
public java.util.List<ValueBox> getUseAndDefBoxes()
Value
,
Unit.getUseAndDefBoxes()
,
ValueBox
,
Value
public void checkInit()
public java.lang.String toString()
toString
in class java.lang.Object
public long getModificationCount()