public abstract class ForwardReference extends Object
There are three kinds of forward reference:
This class also includes the machinery for maintaining a priority queue of forward references, priorities being target bytecode addresses. The head of this priority queue is maintained by a Assembler object.
The priority queue is implemented as a one-way linked list of forward references with strictly increasing targets. The link for this list is "next". A separate linked list ("other" is the link) contains all forward references with the same target.
Modifier and Type | Class and Description |
---|---|
static class |
ForwardReference.ConditionalBranch |
static class |
ForwardReference.LoadReturnAddress |
static class |
ForwardReference.ShortBranch |
static class |
ForwardReference.SwitchCase |
static class |
ForwardReference.UnconditionalBranch |
Modifier and Type | Field and Description |
---|---|
(package private) ForwardReference |
next
Has next larger targetBytecodeIndex
|
(package private) ForwardReference |
other
Has the same targetBytecodeIndex
|
(package private) int |
sourceMachinecodeIndex |
(package private) int |
targetBytecodeIndex |
Modifier | Constructor and Description |
---|---|
protected |
ForwardReference(int source) |
protected |
ForwardReference(int source,
int btarget) |
Modifier and Type | Method and Description |
---|---|
static ForwardReference |
enqueue(ForwardReference q,
ForwardReference r)
Adds a new reference to a priority queue.
|
abstract void |
resolve(AbstractAssembler asm)
Rewrite source to reference current machine code (in asm's machineCodes)
|
static ForwardReference |
resolveMatching(AbstractAssembler asm,
ForwardReference q,
int bi)
Resolve any forward references on the priority queue for the given
bytecode index.
|
final int sourceMachinecodeIndex
final int targetBytecodeIndex
ForwardReference next
ForwardReference other
protected ForwardReference(int source, int btarget)
protected ForwardReference(int source)
public abstract void resolve(AbstractAssembler asm)
asm
- the assembler to use to resolve the referencepublic static ForwardReference enqueue(ForwardReference q, ForwardReference r)
q
- a forward reference acting as a priority queuer
- a new reference to enqueuepublic static ForwardReference resolveMatching(AbstractAssembler asm, ForwardReference q, int bi)
asm
- assembler to use for resolutionq
- priority queuebi
- bytecode index