RFR: 8139457: Relax alignment of array elements [v69]

Roman Kennke rkennke at openjdk.org
Thu Mar 14 08:29:00 UTC 2024


On Thu, 14 Mar 2024 07:58:11 GMT, Liang Mao <lmao at openjdk.org> wrote:

> Hi Roman,
> 
> I found a potential bug but didn't realized this PR was already integrated recently. Sorry for my negligence. It's a rare crash in aarch64 with G1 GC. The root cause is that default behavior of MacroAssembler::arrays_equals will blindly load whole word before comparison. When the array[0] is aligned to 32-bit, the last word load will exceed the array limit and may touch the next word beyong object layout in heap memory. If the next word which doesn't belong to object self happens to be the boundary of pages and G1 heap regions, the segmentation fault will be triggered. Loading the last word blindly is benign for 64-bit aligned array because it is always inside the object self. We proposed JDK-8328138 to optimize the aarch64 array equals implementation to both handle word aligned or unaligned array correctly and have better performance in ARM neoverse n1&n2 architectures. Apologize again for my delay. Please help to take a review.

Thanks for the heads-up, this is a very good point. Wouldn't we get wrong results for array-equals if we blindly compare the last word, if it doesn't actually belong to the array contents?

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

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


More information about the hotspot-dev mailing list