|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soot.tagkit.AbstractHost soot.Body
public abstract class Body
Abstract base class that models the body (code attribute) of a Java method. Classes that implement an Intermediate Representation for a method body should subclass it. In particular the classes GrimpBody, JimpleBody and BafBody all extend this class. This class provides methods that are common to any IR, such as methods to get the body's units (statements), traps, and locals.
GrimpBody
,
JimpleBody
,
BafBody
,
Serialized FormField Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
protected |
Body()
Creates an extremely empty Body. |
protected |
Body(SootMethod m)
Creates a Body associated to the given method. |
Method Summary | |
---|---|
void |
checkInit()
|
abstract Object |
clone()
Creates a deep copy of this Body. |
List<UnitBox> |
getAllUnitBoxes()
Returns the result of iterating through all Units in this body and querying them for their UnitBoxes. |
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. |
Local |
getParameterLocal(int i)
Return LHS of the first identity stmt assigning from \@parameter i. |
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. |
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. |
List<ValueBox> |
getUseAndDefBoxes()
Returns a list of boxes corresponding to Values either used or defined in any unit of this Body. |
List<ValueBox> |
getUseBoxes()
Returns the result of iterating through all Units in this body and querying them for ValueBoxes used. |
Map<Object,Object> |
importBodyContentsFrom(Body b)
Copies the contents of the given Body into this one. |
void |
setMethod(SootMethod method)
Sets the method associated with this Body. |
String |
toString()
|
void |
validate()
Verifies a few sanity conditions on the contents on this body. |
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. |
Methods inherited from class soot.tagkit.AbstractHost |
---|
addAllTagsOf, addTag, getTag, getTags, hasTag, removeAllTags, removeTag |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient SootMethod method
protected Chain<Local> localChain
protected Chain<Trap> trapChain
protected PatchingChain<Unit> unitChain
Constructor Detail |
---|
protected Body(SootMethod m)
protected Body()
Method Detail |
---|
public abstract Object clone()
clone
in class Object
public SootMethod getMethod()
public void setMethod(SootMethod method)
method
- the method that owns this body.public int getLocalCount()
public Map<Object,Object> importBodyContentsFrom(Body b)
public void validate()
public void validateValueBoxes()
public void validateLocals()
public void validateTraps()
public void validateUnitBoxes()
public void validateUses()
public Chain<Local> getLocals()
public Chain<Trap> getTraps()
public Local getThisLocal()
public Local getParameterLocal(int i)
public PatchingChain<Unit> getUnits()
PatchingChain
,
Unit
public 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 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 List<ValueBox> getUseBoxes()
Value
,
Unit.getUseBoxes()
,
ValueBox
,
Value
public List<ValueBox> getDefBoxes()
Value
,
Unit.getDefBoxes()
,
ValueBox
,
Value
public List<ValueBox> getUseAndDefBoxes()
Value
,
Unit.getUseAndDefBoxes()
,
ValueBox
,
Value
public void checkInit()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |