RFR: 8356275: TestCodeEntryAlignment fails with "Alignment must be <= CodeEntryAlignment"
Dean Long
dlong at openjdk.org
Tue May 13 20:10:55 UTC 2025
On Mon, 12 May 2025 10:48:06 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:
> 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.
Sorry for getting to this too late, but we also have the align32() function on x86 that would have worked for situations like this. See also [JDK-8273459](https://bugs.openjdk.org/browse/JDK-8273459).
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25180#issuecomment-2877817647
More information about the hotspot-dev
mailing list