RFR: 8359378: aarch64: crash when using -XX:+UseFPUForSpilling
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Fri Sep 26 10:14:42 UTC 2025
On Wed, 17 Sep 2025 16:19:12 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:
> AArch64 BarrierSetAssembler path assumes only FP/vector ideal regs reach the FP spill/restore encoding. With -XX:+UseFPUForSpilling Register Allocator may allocate scalar values in FP registers. When such values (Op_RegI/Op_RegN/Op_RegL/Op_RegP) hit `BarrierSetAssembler::encode_float_vector_register_size`, we trip ShouldNotReachHere in release build and **"unexpected ideal register"** assertion in debug build.
>
> Fix: teach the encoder to handle scalar ideal regs when they physically live in FP regs:
> - treat Op_RegI / Op_RegN as 32-bit (single slot) - same class as Op_RegF
> - treat Op_RegL / Op_RegP as 64-bit (two slots) - same class as Op_RegD
>
> Related:
> - reproduced since #19746
> - spilling logic:
> - #18967
> - #17977
>
> Testing: tier1-3 with javaoptions -Xcomp -Xbatch -XX:+UseFPUForSpilling on AARCH
> I suggest handling this in two steps:
>
> * In JDK 25 we fix the crash when UseFPUForSpilling is enabled.
> * In the next release we prohibit the option softly: if it is set on the command line, the VM prints a warning and resets it to false. Proposed change for the latter:
>
> ```diff
> diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
> index 308deeaf5e2..7702988c11c 100644
> --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
> +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
> @@ -621,4 +621,9 @@ void VM_Version::initialize() {
> FLAG_SET_DEFAULT(UseVectorizedHashCodeIntrinsic, true);
> }
> +
> + if (UseFPUForSpilling) {
> + warning("UseFPUForSpilling is known to degrade performance on this platform and will be ignored.");
> + FLAG_SET_DEFAULT(UseFPUForSpilling, false);
> + }
> #endif
>
> ```
This seems reasonable to me as well.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27350#issuecomment-3337898957
More information about the hotspot-compiler-dev
mailing list