Class BasicBlock
- All Implemented Interfaces:
Debug, GraphVertex<BasicBlock>, Comparable<BasicBlock>
Simple basic block abstraction for BCEL.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA forward Iterator over the instructions of a basic block.private static classA reverse Iterator over the instructions in a basic block. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.bcel.generic.CodeExceptionGenprivate org.apache.bcel.generic.InstructionHandleprivate org.apache.bcel.generic.InstructionHandleprivate booleanprivate org.apache.bcel.generic.InstructionHandleprivate static final BitSetSet of instruction opcodes that have an implicit null check.private intFields inherited from interface Debug
VERIFY_INTEGRITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInstruction(org.apache.bcel.generic.InstructionHandle handle) Add an InstructionHandle to the basic block.booleancontainsInstruction(org.apache.bcel.generic.InstructionHandle handle) Return whether or not the basic block contains the given instruction.booleancontainsInstructionWithOffset(int offset) Return whether or not the basic block contains the instruction with the given bytecode offset.org.apache.bcel.generic.CodeExceptionGenGet CodeExceptionGen object; returns null if this basic block is not the entry point of an exception handler.org.apache.bcel.generic.InstructionHandleGet the instruction for which this block is an exception thrower.org.apache.bcel.generic.InstructionHandleGet the first instruction in the basic block.intgetId()Deprecated.call getLabel() insteadorg.apache.bcel.generic.InstructionHandleGet the last instruction in the basic block.(package private) intorg.apache.bcel.generic.InstructionHandlegetPredecessorOf(org.apache.bcel.generic.InstructionHandle handle) Get the predecessor of given instruction within the basic block.org.apache.bcel.generic.InstructionHandlegetSuccessorOf(org.apache.bcel.generic.InstructionHandle handle) Get the successor of given instruction within the basic block.Get an Iterator over the instructions in the basic block.Iterator<org.apache.bcel.generic.InstructionHandle> Get an Iterator over the instructions in the basic block in reverse order.booleanisEmpty()Return true if there are no Instructions in this basic block.booleanIs this block an exception handler?booleanReturn whether or not this block is an exception thrower.booleanbooleanReturn whether or not this block is a null check.intpos()voidsetExceptionGen(TypeMerger m, org.apache.bcel.generic.CodeExceptionGen exceptionGen) Set the CodeExceptionGen object.voidsetExceptionThrower(org.apache.bcel.generic.InstructionHandle exceptionThrower) Set the instruction for which this block is the ETB.(package private) voidsetInJSRSubroutine(boolean inJSRSubroutine) (package private) voidsetNumNonExceptionSuccessors(int numNonExceptionSuccessors) toString()
-
Field Details
-
nullCheckInstructionSet
Set of instruction opcodes that have an implicit null check. -
firstInstruction
private org.apache.bcel.generic.InstructionHandle firstInstruction -
lastInstruction
private org.apache.bcel.generic.InstructionHandle lastInstruction -
exceptionThrower
private org.apache.bcel.generic.InstructionHandle exceptionThrower -
exceptionGen
private org.apache.bcel.generic.CodeExceptionGen exceptionGen -
inJSRSubroutine
private boolean inJSRSubroutine -
numNonExceptionSuccessors
private int numNonExceptionSuccessors
-
-
Constructor Details
-
BasicBlock
public BasicBlock()Constructor.
-
-
Method Details
-
isInJSRSubroutine
public boolean isInJSRSubroutine() -
setInJSRSubroutine
void setInJSRSubroutine(boolean inJSRSubroutine) -
getId
Deprecated.call getLabel() insteadGet the basic block's integer label.- Returns:
- the BasicBlock's integer label
-
toString
-
setExceptionThrower
public void setExceptionThrower(org.apache.bcel.generic.InstructionHandle exceptionThrower) Set the instruction for which this block is the ETB.- Parameters:
exceptionThrower- the instruction
-
isExceptionThrower
public boolean isExceptionThrower()Return whether or not this block is an exception thrower. -
getExceptionThrower
public org.apache.bcel.generic.InstructionHandle getExceptionThrower()Get the instruction for which this block is an exception thrower.- Returns:
- the instruction, or null if this block is not an exception thrower
-
isNullCheck
public boolean isNullCheck()Return whether or not this block is a null check. -
getFirstInstruction
public org.apache.bcel.generic.InstructionHandle getFirstInstruction()Get the first instruction in the basic block. -
getLastInstruction
public org.apache.bcel.generic.InstructionHandle getLastInstruction()Get the last instruction in the basic block. -
getSuccessorOf
@CheckForNull public org.apache.bcel.generic.InstructionHandle getSuccessorOf(org.apache.bcel.generic.InstructionHandle handle) Get the successor of given instruction within the basic block.- Parameters:
handle- the instruction- Returns:
- the instruction's successor, or null if the instruction is the last in the basic block
-
getPredecessorOf
public org.apache.bcel.generic.InstructionHandle getPredecessorOf(org.apache.bcel.generic.InstructionHandle handle) Get the predecessor of given instruction within the basic block.- Parameters:
handle- the instruction- Returns:
- the instruction's predecessor, or null if the instruction is the first in the basic block
-
addInstruction
public void addInstruction(org.apache.bcel.generic.InstructionHandle handle) Add an InstructionHandle to the basic block.- Parameters:
handle- the InstructionHandle
-
instructionIterator
Get an Iterator over the instructions in the basic block. -
instructionReverseIterator
Get an Iterator over the instructions in the basic block in reverse order. This is useful for backwards dataflow analyses. -
isEmpty
public boolean isEmpty()Return true if there are no Instructions in this basic block. -
pos
public int pos() -
isExceptionHandler
public boolean isExceptionHandler()Is this block an exception handler? -
getExceptionGen
public org.apache.bcel.generic.CodeExceptionGen getExceptionGen()Get CodeExceptionGen object; returns null if this basic block is not the entry point of an exception handler.- Returns:
- the CodeExceptionGen object, or null
-
setExceptionGen
public void setExceptionGen(@Nullable TypeMerger m, org.apache.bcel.generic.CodeExceptionGen exceptionGen) Set the CodeExceptionGen object. Marks this basic block as the entry point of an exception handler.- Parameters:
exceptionGen- the CodeExceptionGen object for the block
-
containsInstruction
public boolean containsInstruction(org.apache.bcel.generic.InstructionHandle handle) Return whether or not the basic block contains the given instruction.- Parameters:
handle- the instruction- Returns:
- true if the block contains the instruction, false otherwise
-
containsInstructionWithOffset
public boolean containsInstructionWithOffset(int offset) Return whether or not the basic block contains the instruction with the given bytecode offset.- Parameters:
offset- the bytecode offset- Returns:
- true if the block contains an instruction with the given offset, false if it does not
-
getNumNonExceptionSuccessors
int getNumNonExceptionSuccessors()- Returns:
- Returns the numNonExceptionSuccessors.
-
setNumNonExceptionSuccessors
void setNumNonExceptionSuccessors(int numNonExceptionSuccessors) - Parameters:
numNonExceptionSuccessors- The numNonExceptionSuccessors to set.
-