[master] RFR: Fix arrays-equals intrinsic on AArch64
Roman Kennke
rkennke at openjdk.org
Wed Apr 24 14:41:48 UTC 2024
The arrays-equals intrinsic on AArch64 assumes that array elements start at 8-byte-aligned boundary. There are several problems with that:
- Doing unaligned loads is likely rather slow.
- I believe it may give wrong results when comparing some junk after the end of the array.
- We may crash when loading beyond the heap boundary.
The proposed fix is to start the comparison at the array-length field. When the array base is unaligned (that is really 4-byte-aligned), then the array-length is at 8-byte-aligned location. And since we want to compare the lengths anyway, we can just as well use word-sized loads to compare the length and first elements in a single step, and elide the separate cmp+branch for the length.
-------------
Commit messages:
- Fix arrays-equals intrinsic on AArch64
Changes: https://git.openjdk.org/lilliput/pull/170/files
Webrev: https://webrevs.openjdk.org/?repo=lilliput&pr=170&range=00
Stats: 42 lines in 1 file changed: 33 ins; 0 del; 9 mod
Patch: https://git.openjdk.org/lilliput/pull/170.diff
Fetch: git fetch https://git.openjdk.org/lilliput.git pull/170/head:pull/170
PR: https://git.openjdk.org/lilliput/pull/170
More information about the lilliput-dev
mailing list