Adds a forward reference to this label. This method must be called only for a true forward reference, i.e. only if this label is not resolved yet. For backward references, the relative bytecode offset of the reference can be, and must be, computed and stored directly. @param sourceInsnBytecodeOffse
(
final int sourceInsnBytecodeOffset, final int referenceType, final int referenceHandle)
| 412 | * stored. |
| 413 | */ |
| 414 | private void addForwardReference( |
| 415 | final int sourceInsnBytecodeOffset, final int referenceType, final int referenceHandle) { |
| 416 | if (forwardReferences == null) { |
| 417 | forwardReferences = new int[FORWARD_REFERENCES_CAPACITY_INCREMENT]; |
| 418 | } |
| 419 | int lastElementIndex = forwardReferences[0]; |
| 420 | if (lastElementIndex + 2 >= forwardReferences.length) { |
| 421 | int[] newValues = new int[forwardReferences.length + FORWARD_REFERENCES_CAPACITY_INCREMENT]; |
| 422 | System.arraycopy(forwardReferences, 0, newValues, 0, forwardReferences.length); |
| 423 | forwardReferences = newValues; |
| 424 | } |
| 425 | forwardReferences[++lastElementIndex] = sourceInsnBytecodeOffset; |
| 426 | forwardReferences[++lastElementIndex] = referenceType | referenceHandle; |
| 427 | forwardReferences[0] = lastElementIndex; |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * Sets the bytecode offset of this label to the given value and resolves the forward references |