[master] Integrated: Fix arrays-equals intrinsic on AArch64

Roman Kennke rkennke at openjdk.org
Thu Apr 25 08:31:40 UTC 2024


On Wed, 24 Apr 2024 14:36:31 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> The arrays-equals intrinsic on AArch64 assumes that array elements start at 8-byte-aligned boundary. There are several problems with that:
> - 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.

This pull request has now been integrated.

Changeset: a512b0a0
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.org/lilliput/commit/a512b0a0884ebec8819512d9f8006663cfcfee17
Stats:     25 lines in 1 file changed: 18 ins; 0 del; 7 mod

Fix arrays-equals intrinsic on AArch64

Reviewed-by: aboldtch

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

PR: https://git.openjdk.org/lilliput/pull/170


More information about the lilliput-dev mailing list