Integrated: 8332724: x86 MacroAssembler may over-align code

Daniel Jeliński djelinski at openjdk.org
Mon May 27 05:26:06 UTC 2024


On Wed, 22 May 2024 19:04:27 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> The methods align32 and align64 are supposed to align the next instruction to the next 32 or 64 byte boundary using the minimum number of NOP bytes. However, when the target represented as a 32bit signed int is negative, the instructions generate 32 or 64 NOP bytes too many. This was observed in `jbyte_disjoint_arraycopy_avx3` on a Linux machine, where a single align32 invocation generated 63 bytes of NOPs.
> 
> This PR addresses the problem by using bit operations to calculate the required number of bytes.
> 
> Tier1-3 tests passed.
> 
> On a side note, `align64` and `align32` instructions were meant for aligning data for use with zmm / ymm loads, but nowadays they are frequently used in places where `align(CodeEntryAlignment)` or `align(OptoLoopAlignment)` would be more appropriate. I can address that in a separate PR if you think it's worth fixing.

This pull request has now been integrated.

Changeset: 08d51003
Author:    Daniel Jeliński <djelinski at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/08d51003d142e89b9d2f66187a4ea50e12b94fbb
Stats:     9 lines in 4 files changed: 0 ins; 0 del; 9 mod

8332724: x86 MacroAssembler may over-align code

Reviewed-by: dlong, kvn

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

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


More information about the hotspot-dev mailing list