[master] RFR: Fix arrays-equals intrinsic on AArch64 [v2]

Roman Kennke rkennke at openjdk.org
Wed Apr 24 16:06:05 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.

Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:

  Simplify

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

Changes:
  - all: https://git.openjdk.org/lilliput/pull/170/files
  - new: https://git.openjdk.org/lilliput/pull/170/files/6d1ea5f5..93adb1e1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=lilliput&pr=170&range=01
 - incr: https://webrevs.openjdk.org/?repo=lilliput&pr=170&range=00-01

  Stats: 55 lines in 1 file changed: 13 ins; 28 del; 14 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