RFR: 8331098: [Aarch64] Fix crash in Arrays.equals() intrinsic with -CCP [v2]
Roman Kennke
rkennke at openjdk.org
Fri Apr 26 10:05:33 UTC 2024
On Fri, 26 Apr 2024 08:51:28 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> The current implementation assumes that the base (first array element) is aligned. In this case, the array length is *not* aligned (8 bytes mark, word, 4 bytes compressed-Klass*, 4 bytes length), that is why in this case we compare the length ahead of the main loop. With uncompressed Klass* (8 bytes mark-word, 8 bytes Klass*, 4 bytes length, ...) or Lilliput (8 bytes mark-word/Klass*, 4 bytes length, ...), the base is only 4-bytes-aligned, but we can start at the length and still enter the main-loop at an 8 bytes aligned address. As a bonus, that also compares the lengths and we can save a few instructions/branches for that.
>
> So what we're saying here is not so much that the base is not aligned, but that the length _is_?
Yes, exactly. Perhaps makes sense to rename the variable to 'base_is_8aligned' or something similar?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18948#discussion_r1580796163
More information about the hotspot-dev
mailing list