public class Label
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
DEBUG
Indicates if this label is only used for debug attributes.
|
(package private) Frame |
frame
Information about the input and output stack map frames of this basic
block.
|
java.lang.Object |
info
Field used to associate user information to a label.
|
(package private) int |
inputStackTop
Start of the output stack relatively to the input stack.
|
(package private) static int |
JSR
Indicates if this basic block ends with a JSR instruction.
|
(package private) int |
line
The line number corresponding to this label, if known.
|
(package private) Label |
next
The next basic block in the basic block stack.
|
(package private) int |
outputStackMax
Maximum height reached by the output stack, relatively to the top of the
input stack.
|
(package private) int |
position
The position of this label in the code, if known.
|
(package private) static int |
PUSHED
Indicates if this basic block has been pushed in the basic block stack.
|
(package private) static int |
REACHABLE
Indicates if this label corresponds to a reachable basic block.
|
private int |
referenceCount
Number of forward references to this label, times two.
|
(package private) static int |
RESIZED
Indicates if this label has been updated, after instruction resizing.
|
(package private) static int |
RESOLVED
Indicates if the position of this label is known.
|
(package private) static int |
RET
Indicates if this basic block ends with a RET instruction.
|
private int[] |
srcAndRefPositions
Informations about forward references.
|
(package private) int |
status
Flags that indicate the status of this label.
|
(package private) static int |
STORE
Indicates if a stack map frame must be stored for this label.
|
(package private) static int |
SUBROUTINE
Indicates if this basic block is the start of a subroutine.
|
(package private) Label |
successor
The successor of this label, in the order they are visited.
|
(package private) Edge |
successors
The successors of this node in the control flow graph.
|
(package private) static int |
TARGET
Indicates if this label is the target of a jump instruction, or the start
of an exception handler.
|
(package private) static int |
VISITED
Indicates if this subroutine basic block has been visited by a
visitSubroutine(null, ...) call.
|
(package private) static int |
VISITED2
Indicates if this subroutine basic block has been visited by a
visitSubroutine(!null, ...) call.
|
Constructor and Description |
---|
Label()
Constructs a new label.
|
Modifier and Type | Method and Description |
---|---|
private void |
addReference(int sourcePosition,
int referencePosition)
Adds a forward reference to this label.
|
(package private) void |
addToSubroutine(long id,
int nbSubroutines)
Marks this basic block as belonging to the given subroutine.
|
(package private) Label |
getFirst()
Returns the first label of the series to which this label belongs.
|
int |
getOffset()
Returns the offset corresponding to this label.
|
(package private) boolean |
inSameSubroutine(Label block)
Returns true if this basic block and the given one belong to a common
subroutine.
|
(package private) boolean |
inSubroutine(long id)
Returns true is this basic block belongs to the given subroutine.
|
(package private) void |
put(MethodWriter owner,
ByteVector out,
int source,
boolean wideOffset)
Puts a reference to this label in the bytecode of a method.
|
(package private) boolean |
resolve(MethodWriter owner,
int position,
byte[] data)
Resolves all forward references to this label.
|
java.lang.String |
toString()
Returns a string representation of this label.
|
(package private) void |
visitSubroutine(Label JSR,
long id,
int nbSubroutines)
Finds the basic blocks that belong to a given subroutine, and marks these
blocks as belonging to this subroutine.
|
static final int DEBUG
static final int RESOLVED
static final int RESIZED
static final int PUSHED
visitMaxs
.static final int TARGET
static final int STORE
static final int REACHABLE
static final int JSR
static final int RET
static final int SUBROUTINE
static final int VISITED
static final int VISITED2
public java.lang.Object info
org.objectweb.asm.tree.MethodNode#getLabelNode
method.int status
int line
int position
private int referenceCount
private int[] srcAndRefPositions
int inputStackTop
int outputStackMax
Frame frame
ClassWriter.COMPUTE_FRAMES
option is used.Label successor
ClassWriter.COMPUTE_FRAMES
option is used then, in addition, it
does not contain successive labels that denote the same bytecode position
(in this case only the first label appears in this list).Edge successors
Label next
visitSubroutine(org.springframework.asm.Label, long, int)
to avoid using a recursive method.MethodWriter.visitMaxs(int, int)
public int getOffset()
Attribute
sub classes, and is normally not needed by class
generators or adapters.java.lang.IllegalStateException
- if this label is not resolved yet.void put(MethodWriter owner, ByteVector out, int source, boolean wideOffset)
owner
- the code writer that calls this method.out
- the bytecode of the method.source
- the position of first byte of the bytecode instruction that
contains this label.wideOffset
- true if the reference must be stored in 4 bytes, or
false if it must be stored with 2 bytes.java.lang.IllegalArgumentException
- if this label has not been created by the given code writer.private void addReference(int sourcePosition, int referencePosition)
sourcePosition
- the position of the referencing instruction. This position
will be used to compute the offset of this forward reference.referencePosition
- the position where the offset for this forward reference must
be stored.boolean resolve(MethodWriter owner, int position, byte[] data)
owner
- the code writer that calls this method.position
- the position of this label in the bytecode.data
- the bytecode of the method.MethodWriter.resizeInstructions()
.java.lang.IllegalArgumentException
- if this label has already been resolved, or if it has not
been created by the given code writer.Label getFirst()
boolean inSubroutine(long id)
id
- a subroutine id.boolean inSameSubroutine(Label block)
block
- another basic block.void addToSubroutine(long id, int nbSubroutines)
id
- a subroutine id.nbSubroutines
- the total number of subroutines in the method.void visitSubroutine(Label JSR, long id, int nbSubroutines)
JSR
- a JSR block that jumps to this subroutine. If this JSR is not
null it is added to the successor of the RET blocks found in
the subroutine.id
- the id of this subroutine.nbSubroutines
- the total number of subroutines in the method.public java.lang.String toString()
toString
in class java.lang.Object