public class Label
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
bytecodeOffset
The offset of this label in the bytecode of its method, in bytes.
|
(package private) static Label |
EMPTY_LIST
A sentinel element used to indicate the end of a list of labels.
|
(package private) static int |
FLAG_DEBUG_ONLY
A flag indicating that a label is only used for debug attributes.
|
(package private) static int |
FLAG_JUMP_TARGET
A flag indicating that a label is the target of a jump instruction, or the start of an
exception handler.
|
(package private) static int |
FLAG_REACHABLE
A flag indicating that a label corresponds to a reachable basic block.
|
(package private) static int |
FLAG_RESOLVED
A flag indicating that the bytecode offset of a label is known.
|
(package private) short |
flags |
(package private) static int |
FORWARD_REFERENCE_HANDLE_MASK
The bit mask to extract the 'handle' of a forward reference to this label.
|
(package private) static int |
FORWARD_REFERENCE_TYPE_MASK
The bit mask to extract the type of a forward reference to this label.
|
(package private) static int |
FORWARD_REFERENCE_TYPE_SHORT
The type of forward references stored with two bytes in the bytecode.
|
(package private) static int |
FORWARD_REFERENCE_TYPE_WIDE
The type of forward references stored in four bytes in the bytecode.
|
(package private) static int |
FORWARD_REFERENCES_CAPACITY_INCREMENT
The number of elements to add to the
forwardReferences array when it needs to be
resized to store a new forward reference. |
private int[] |
forwardReferences
The forward references to this label.
|
(package private) Frame |
frame |
java.lang.Object |
info
A user managed state associated with this label.
|
(package private) Label |
nextBasicBlock |
(package private) Label |
nextListElement |
(package private) Edge |
outgoingEdges |
(package private) short |
outputStackMax
The maximum height reached by the output stack, relatively to the top of the input stack, in
the basic block corresponding to this label.
|
| Constructor and Description |
|---|
Label()
Constructs a new label.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addForwardReference(int sourceInsnBytecodeOffset,
int referenceType,
int referenceHandle)
Adds a forward reference to this label.
|
(package private) Label |
getCanonicalInstance() |
(package private) void |
put(ByteVector code,
int sourceInsnBytecodeOffset,
boolean wideReference)
Puts a reference to this label in the bytecode of a method.
|
(package private) boolean |
resolve(byte[] code,
int bytecodeOffset)
Sets the bytecode offset of this label to the given value and resolves the forward references
to this label, if any.
|
static final int FLAG_DEBUG_ONLY
static final int FLAG_JUMP_TARGET
static final int FLAG_RESOLVED
static final int FLAG_REACHABLE
static final int FORWARD_REFERENCES_CAPACITY_INCREMENT
forwardReferences array when it needs to be
resized to store a new forward reference.static final int FORWARD_REFERENCE_TYPE_MASK
FORWARD_REFERENCE_TYPE_SHORT or FORWARD_REFERENCE_TYPE_WIDE.forwardReferences,
Constant Field Valuesstatic final int FORWARD_REFERENCE_TYPE_SHORT
static final int FORWARD_REFERENCE_TYPE_WIDE
static final int FORWARD_REFERENCE_HANDLE_MASK
FORWARD_REFERENCE_TYPE_MASK).forwardReferences,
Constant Field Valuesstatic final Label EMPTY_LIST
nextListElementpublic java.lang.Object info
short flags
int bytecodeOffset
FLAG_RESOLVED flag is set.private int[] forwardReferences
FORWARD_REFERENCE_TYPE_MASK
and FORWARD_REFERENCE_HANDLE_MASK.
For instance, for an ifnull instruction at bytecode offset x, 'sourceInsnBytecodeOffset' is
equal to x, and 'reference' is of type FORWARD_REFERENCE_TYPE_SHORT with value x + 1
(because the ifnull instruction uses a 2 bytes bytecode offset operand stored one byte after
the start of the instruction itself). For the default case of a lookupswitch instruction at
bytecode offset x, 'sourceInsnBytecodeOffset' is equal to x, and 'reference' is of type FORWARD_REFERENCE_TYPE_WIDE with value between x + 1 and x + 4 (because the lookupswitch
instruction uses a 4 bytes bytecode offset operand stored one to four bytes after the start of
the instruction itself).
short outputStackMax
Frame frame
Label nextBasicBlock
Edge outgoingEdges
Label nextListElement
final Label getCanonicalInstance()
final void put(ByteVector code, int sourceInsnBytecodeOffset, boolean wideReference)
code - the bytecode of the method. This is where the reference is appended.sourceInsnBytecodeOffset - the bytecode offset of the instruction that contains the
reference to be appended.wideReference - whether the reference must be stored in 4 bytes (instead of 2 bytes).private void addForwardReference(int sourceInsnBytecodeOffset,
int referenceType,
int referenceHandle)
sourceInsnBytecodeOffset - the bytecode offset of the instruction that contains the
reference stored at referenceHandle.referenceType - either FORWARD_REFERENCE_TYPE_SHORT or FORWARD_REFERENCE_TYPE_WIDE.referenceHandle - the offset in the bytecode where the forward reference value must be
stored.final boolean resolve(byte[] code,
int bytecodeOffset)
code - the bytecode of the method.bytecodeOffset - the bytecode offset of this label.