Integrated: 8307572: AArch64: Vector registers are clobbered by some macroassemblers

Ningsheng Jian njian at openjdk.org
Fri May 12 02:08:57 UTC 2023


On Wed, 10 May 2023 06:36:13 GMT, Ningsheng Jian <njian at openjdk.org> wrote:

> I found that MacroAssembler::arrays_equals() would call stubcode, which may use vector registers. However, the call site in match rule does not claim the use of vector registers. Since c2 will allocate v16-v31 first [1], it's rare that using of v0-v7 will cause problem, but I did create a test case to expose the bug.
> 
> Apart from arrays_equals, I also checked other macroassemblers, and found several similar issues. Fixed by claiming those vector register being killed in match rules call sites, which should have minimal performance impact compared to always saving/restoring those vector registers, since those V0-Vx registers are rarely allocated and live cross the macroassembler call.
> 
> A jtreg test case is also added to demonstrate the failure. Test will fail without this patch, and pass with this patch.
> 
> Test: I tried to update the allocation order in [1] to allocate V0-V15 first and then V16-V31, and full jtreg tests passed with the allocation order changed. (I did found some test failures with this allocation order change without this patch). I have also eyeballed and checked other macroassembler calls, and others seemed fine.
> 
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/aarch64.ad#L424

This pull request has now been integrated.

Changeset: 33d9a857
Author:    Ningsheng Jian <njian at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/33d9a857308eed53e06b448691910bc8aa2f8fc9
Stats:     391 lines in 6 files changed: 334 ins; 0 del; 57 mod

8307572: AArch64: Vector registers are clobbered by some macroassemblers

Reviewed-by: aph, adinn

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

PR: https://git.openjdk.org/jdk/pull/13895


More information about the hotspot-dev mailing list