|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.graphs.Node sofya.graphs.cfg.Block
public class Block
A block represents a basic block of a control flow graph. A basic block is one in which control enters at one end and exits at the other end without being broken. A block knows about its label, type, subtype, offset where it starts, and offset where it ends.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface sofya.base.SConstants |
---|
SConstants.BlockLabel, SConstants.BlockObjectType, SConstants.BlockSubType, SConstants.BlockType, SConstants.BranchObjectType, SConstants.BranchType, SConstants.EDObjectType, SConstants.TraceObjectType |
Field Summary | |
---|---|
protected int |
endOffset
The end offset of this block. |
protected java.lang.Object |
endRef
Reference to a relevant entity at the end of the block. |
protected SConstants.BlockLabel |
label
The character label for the node type of this block. |
protected int |
startOffset
The start offset of this block. |
protected java.lang.Object |
startRef
Reference to a relevant entity at the start of the block. |
protected SConstants.BlockSubType |
subType
The integer mapping to the subtype of this block. |
protected SConstants.BlockType |
type
The integer mapping to the type of this block. |
static Block[] |
ZL_ARRAY
Zero-length block array useful for specifying array cast types to methods such Node.getSuccessors(Node[]) . |
Fields inherited from class sofya.graphs.Node |
---|
nodeID, predecessors, successors |
Fields inherited from interface sofya.base.SConstants |
---|
DEFAULT_PORT, INST_COMPATIBLE, INST_OLD_UNSUPPORTED, INST_OPT_NORMAL, INST_OPT_SEQUENCE, SIG_CHKALIVE, SIG_ECHO |
Constructor Summary | |
---|---|
Block()
Creates a new block with fields initialized to default values. |
|
Block(int id)
Creates a new block with a given ID and all other fields initialized to default values. |
|
Block(int id,
SConstants.BlockType type,
SConstants.BlockSubType subType)
Creates a new block with a given ID, type, and sub-type. |
|
Block(int id,
SConstants.BlockType type,
SConstants.BlockSubType subType,
SConstants.BlockLabel label)
Creates a new block. |
|
Block(int id,
SConstants.BlockType type,
SConstants.BlockSubType subType,
SConstants.BlockLabel label,
int startOffset,
int endOffset)
Creates a new block. |
|
Block(int id,
SConstants.BlockType type,
SConstants.BlockSubType subType,
SConstants.BlockLabel label,
int startOffset,
int endOffset,
java.lang.Object startRef,
java.lang.Object endRef)
Creates a new block. |
Method Summary | |
---|---|
int |
getEndOffset()
Gets the end offset for this block. |
java.lang.Object |
getEndRef()
Gets the reference to an object of interest associated with the end of the block. |
SConstants.BlockLabel |
getLabel()
Gets the block label. |
int |
getStartOffset()
Gets the start offset for this block. |
java.lang.Object |
getStartRef()
Gets the reference to an object of interest associated with the start of the block. |
SConstants.BlockSubType |
getSubType()
Gets the block subtype. |
Block[] |
getSuccessors(SConstants.BlockType type,
SConstants.BlockSubType subType)
Gets the successors of this block which are of a given type and subtype. |
SConstants.BlockType |
getType()
Gets the block type. |
void |
setEndOffset(int i)
Sets the end offset variable to the given value. |
void |
setEndRef(java.lang.Object ref)
Sets a reference to an object of interest to be associated with the end of the block. |
void |
setLabel(SConstants.BlockLabel bl)
Sets the block label to the given value. |
void |
setStartOffset(int i)
Sets the start offset variable to the given value. |
void |
setStartRef(java.lang.Object ref)
Sets a reference to an object of interest to be associated with the start of the block. |
void |
setSubType(SConstants.BlockSubType bst)
Sets the block subtype to the given value. |
void |
setType(SConstants.BlockType bt)
Sets the block type to the given value. |
java.lang.String |
toString()
Returns a string representation of this block in the form: (nodeID, (nodeType, nodeSubType, nodeLabel),
[startOffset, endOffset]) . |
Methods inherited from class sofya.graphs.Node |
---|
addPredecessor, addSuccessor, getID, getPredecessorCount, getPredecessors, getPredecessors, getPredecessorsList, getSuccessorCount, getSuccessors, getSuccessors, getSuccessorsList, main, removePredecessor, removeSuccessor, setID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SConstants.BlockType type
protected SConstants.BlockSubType subType
protected SConstants.BlockLabel label
protected int startOffset
protected int endOffset
protected java.lang.Object startRef
protected java.lang.Object endRef
public static final Block[] ZL_ARRAY
Node.getSuccessors(Node[])
.
Constructor Detail |
---|
public Block()
public Block(int id)
id
- ID to be associated with the new block.public Block(int id, SConstants.BlockType type, SConstants.BlockSubType subType)
id
- ID to be associated with the new block.type
- Main type of the new block.subType
- Secondary type of the new block.public Block(int id, SConstants.BlockType type, SConstants.BlockSubType subType, SConstants.BlockLabel label)
id
- ID to be associated with the new block.type
- Main type of the new block.subType
- Secondary type of the new block.label
- Label (character) associated with the new block.public Block(int id, SConstants.BlockType type, SConstants.BlockSubType subType, SConstants.BlockLabel label, int startOffset, int endOffset)
id
- ID to be associated with the new block.type
- Main type of the new block.subType
- Secondary type of the new block.label
- Label (character) associated with the new block.startOffset
- Offset of the first bytecode instruction in
the new block.endOffset
- Offset of the last bytecode instruction in the
new block.public Block(int id, SConstants.BlockType type, SConstants.BlockSubType subType, SConstants.BlockLabel label, int startOffset, int endOffset, java.lang.Object startRef, java.lang.Object endRef)
id
- ID to be associated with the new block.type
- Main type of the new block.subType
- Secondary type of the new block.label
- Label (character) associated with the new block.startOffset
- Offset of the first bytecode instruction in
the new block.startRef
- Reference to an object with some meaningful correlation
to the start of the new block; typically used to reference the BCEL
instruction handle of the first instruction in the block.endRef
- Reference to an object with some meaningful correlation
to the end of the new block; typically used to reference the BCEL
instruction handle of the last instruction in the block.Method Detail |
---|
public void setType(SConstants.BlockType bt)
bt
- Block type to assign to this block.public SConstants.BlockType getType()
public void setSubType(SConstants.BlockSubType bst)
bst
- Block subtype to assign to this block.public SConstants.BlockSubType getSubType()
public void setLabel(SConstants.BlockLabel bl)
bl
- Label which this block should be assigned .public SConstants.BlockLabel getLabel()
public void setStartOffset(int i)
i
- Integer representing the new start offset for this block.public int getStartOffset()
public void setEndOffset(int i)
i
- Integer representing the new end offset for this block.public int getEndOffset()
public void setStartRef(java.lang.Object ref)
For example, the CFG
class stores a
reference to the BCEL InstructionHandle
which represents
the beginning of the block to improve the performance of the
cfInstrumentor
.
ref
- Reference to object to be associated with the start of
the block.public java.lang.Object getStartRef()
public void setEndRef(java.lang.Object ref)
For example, the CFG
class stores a
reference to the BCEL InstructionHandle
which represents
the end of the block to improve the performance of the
cfInstrumentor
.
ref
- Reference to object to be associated with the end of
the block.public java.lang.Object getEndRef()
public Block[] getSuccessors(SConstants.BlockType type, SConstants.BlockSubType subType)
type
- Major type that must be matched for a successor to
be returned.subType
- Subtype that must be matched for a successor to
be returned.
public java.lang.String toString()
(nodeID, (nodeType, nodeSubType, nodeLabel),
[startOffset, endOffset])
.
toString
in class Node
Node.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |