`DirectCodeBuilder` stores target bytecode offsets directly in `Label` instances created by `BufferedCodeBuilder`. With `ShortJumpsOption.FIX_SHORT_JUMPS`, it rewrites out-of-range short jumps to equivalent instructions. When this requires a second pass, the new builder reuses the same buffered labels and can mistake offsets left over from the first pass for valid targets.
The fix clears the offsets of deferred labels owned by `BufferedCodeBuilder` before the second pass. `ShortJumpsFixTest` now exercises this buffered transform chain and verifies the generated bytecode in addition to checking the expected opcode sequence. Please review. Thank you, Adam --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - added bug # and copyright year bump - 8398515: Chained method transform writes a branch to the wrong place Changes: https://git.openjdk.org/jdk/pull/34124/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=34124&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8398515 Stats: 62 lines in 2 files changed: 38 ins; 0 del; 24 mod Patch: https://git.openjdk.org/jdk/pull/34124.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/34124/head:pull/34124 PR: https://git.openjdk.org/jdk/pull/34124
