public class BasicBranchUnit extends java.lang.Object implements BranchUnit
BranchUnit
remembers the branch unit commands that are invoked on it. It doesn't
consider conditions when branching.Modifier and Type | Field and Description |
---|---|
protected InstructionOffsetValue |
traceBranchTargets |
protected boolean |
wasCalled |
Constructor and Description |
---|
BasicBranchUnit() |
Modifier and Type | Method and Description |
---|---|
void |
branch(Clazz clazz,
CodeAttribute codeAttribute,
int offset,
int branchTarget)
Sets the new instruction offset.
|
void |
branchConditionally(Clazz clazz,
CodeAttribute codeAttribute,
int offset,
int branchTarget,
int conditional)
Sets the new instruction offset, depending on the certainty of the conditional branch.
|
InstructionOffsetValue |
getTraceBranchTargets()
Returns the accumulated branch targets that were passed to the branch unit methods.
|
void |
reset()
Resets the accumulated branch targets and the flag that tells whether any of the branch unit
methods was called.
|
void |
returnFromMethod()
Returns from the method with the given value.
|
void |
throwException()
Handles the throwing of an exception.
|
boolean |
wasCalled()
Returns whether any of the branch unit methods was called.
|
protected InstructionOffsetValue traceBranchTargets
protected boolean wasCalled
public void reset()
public boolean wasCalled()
public InstructionOffsetValue getTraceBranchTargets()
public void branch(Clazz clazz, CodeAttribute codeAttribute, int offset, int branchTarget)
BranchUnit
branch
in interface BranchUnit
public void branchConditionally(Clazz clazz, CodeAttribute codeAttribute, int offset, int branchTarget, int conditional)
BranchUnit
branchConditionally
in interface BranchUnit
public void returnFromMethod()
BranchUnit
returnFromMethod
in interface BranchUnit
public void throwException()
BranchUnit
throwException
in interface BranchUnit