RFR: 8356275: TestCodeEntryAlignment fails with "Alignment must be <= CodeEntryAlignment"
Marc Chevalier
mchevalier at openjdk.org
Mon May 12 12:09:05 UTC 2025
In the [original code](https://github.com/intel/intel-ipsec-mb/blob/9b607277c75dc7994615700a7ebd5d02e74b52a7/lib/avx2_t4/sha512_x1_ni_avx2.asm#L153), we have an `align 32` here.
This alignment is pure optimization: we align the head of the loop to make the CPU happier. But if we set `CodeEntryAlignment` to 16, the 32 alignment makes an assert fail. Let's align to `CodeEntryAlignment` instead. It should be 32 by default, but if someone has a different opinion, it's still fine. Anyway, this alignment doesn't seem useful for correctness, so the consequences of an insufficient alignment are small. On the other hand, if someone wants to set `CodeEntryAlignment` to 64 for instance, it's also ok: 64-bit alignment is also a 32-bit alignment. We just lose a bit of space for no good reason but the user's input stating that we should prefer 64-bit alignment.
It seems questionable to me whether there is any sense in overriding the alignment when using such advanced features, that only exists on modern enough CPUs, so not with a 16-bit alignment, but for consistency, I suppose.
-------------
Commit messages:
- Fix alignment
Changes: https://git.openjdk.org/jdk/pull/25180/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25180&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356275
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/25180.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25180/head:pull/25180
PR: https://git.openjdk.org/jdk/pull/25180
More information about the hotspot-dev
mailing list