From 8ec87dceaa79aa9eb02080190a447f9e2aae9cab Mon Sep 17 00:00:00 2001 From: krk Date: Wed, 11 Dec 2024 14:30:32 +0000 Subject: [PATCH] Backport 3c60f0b2bb75150d49da9ab94d88b767275de5e2 --- src/hotspot/cpu/aarch64/vm_version_aarch64.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 48b9dcf32b8..99b8f9f8a66 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -442,7 +442,19 @@ void VM_Version::initialize() { } if (UseSVE > 0) { - _initial_sve_vector_length = get_current_sve_vector_length(); + int vl = get_current_sve_vector_length(); + if (vl < 0) { + warning("Unable to get SVE vector length on this system. " + "Disabling SVE. Specify -XX:UseSVE=0 to shun this warning."); + FLAG_SET_DEFAULT(UseSVE, 0); + } else if ((vl == 0) || ((vl % FloatRegister::sve_vl_min) != 0) || !is_power_of_2(vl)) { + warning("Detected SVE vector length (%d) should be a power of two and a multiple of %d. " + "Disabling SVE. Specify -XX:UseSVE=0 to shun this warning.", + vl, FloatRegister::sve_vl_min); + FLAG_SET_DEFAULT(UseSVE, 0); + } else { + _initial_sve_vector_length = vl; + } } // This machine allows unaligned memory accesses