On Mon, 30 Nov 2026 14:05:23 GMT, Adam Sotona <[email protected]> wrote:

> `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).

This pull request has now been integrated.

Changeset: 464d00d0
Author:    Adam Sotona <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/464d00d09b78eb051fae901d2a7bc9285891bf0d
Stats:     62 lines in 2 files changed: 38 ins; 0 del; 24 mod

8398515: Chained method transform writes a branch to the wrong place

Reviewed-by: liach

-------------

PR: https://git.openjdk.org/jdk/pull/34124

Reply via email to