RFR: 8332724: x86 MacroAssembler may over-align code [v3]

Daniel Jeliński djelinski at openjdk.org
Thu May 23 18:15:27 UTC 2024


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

Daniel Jeliński has updated the pull request incrementally with one additional commit since the last revision:

  Fix 32-bit compilation

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19353/files
  - new: https://git.openjdk.org/jdk/pull/19353/files/d0220193..6a7021a3

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19353&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19353&range=01-02

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/19353.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19353/head:pull/19353

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


More information about the hotspot-dev mailing list