RFR: 8139457: Array bases are aligned at HeapWord granularity [v61]

Roman Kennke rkennke at openjdk.org
Mon Oct 30 10:42:56 UTC 2023


On Fri, 27 Oct 2023 10:07:34 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> Just to check: object headers of arrays are still aligned to 8-bytes, and only the elements alignment of e.g. a `byte[]` is 4? If that's the case, than someone can always get back to 8-byte alignment simply by adding 4 bytes of offset when doing the access. Probably not great to rely on that though.

Object headers are always 8-byte-aligned and I have no plans to change that.
Only elements of byte, boolean, short, char, int, float and compressed-oops elements will be 4-byte aligned (with -UseCompressedClassPointers and later with +UseCompactHeaders). long and double and uncompressed oops elements will remain 8-byte-aligned.

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

PR Comment: https://git.openjdk.org/jdk/pull/11044#issuecomment-1784913173


More information about the hotspot-dev mailing list