RFR: 8365265: x86 short forward jump exceeds 8-bit offset in methodHandles_x86.cpp when using Intel APX

Aleksey Shipilev shade at openjdk.org
Tue Aug 12 10:22:13 UTC 2025


On Tue, 12 Aug 2025 10:06:58 GMT, Andrew Haley <aph at openjdk.org> wrote:

> Well, yes. I'm suggesting that we should generate short branches automagically.

We do generate short branches auto-magically, but only for back-branches, where we know where the target is at the time we emit the jump. So _forward jumps_ get the short (pun intended) end of the stick. 

I thought about this a bit a few years back: I can imagine how could one do multiple scratch emits that try to progressively figure out which forward jumps can be shortened. That would need to be iterative, because shortening an _inner_ jump likely opens opportunities for shortening more _outer_ jumps. So this opens a question how this all impacts compilation time. I guess it is not prohibitive for small code blobs like stubs. But then, going through all this hassle to only optimize stubs? We might as well spend this time hand-optimizing the forward jumps by hand :)

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

PR Comment: https://git.openjdk.org/jdk/pull/26731#issuecomment-3178717699


More information about the hotspot-compiler-dev mailing list