RFR: 8364128: Improve gathering of cpu feature names using stringStream [v5]

Ashay Rane duke at openjdk.org
Fri Feb 27 21:01:34 UTC 2026


On Fri, 27 Feb 2026 20:55:58 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> No, there isn't a JIRA issue (I don't have Author status to be able to create new issues).
>
> @raneashay for you reference here is the JIRA issue: https://bugs.openjdk.org/browse/JDK-8378871
> If you can, feel free to add comments about the impact of this bug in the JIRA issue.

@ashu-mehra There isn't a crash or a build failure.  I noticed the problem when I was adding support for a different CPU feature and `_features` wasn't getting populated correctly.

The following changes fixed the problem:

in `VM_Version::get_current_sve_vector_length()` and `VM_Version::set_and_get_current_sve_vector_length()`:

-  assert(_features & CPU_SVE, "should not call this");
+  assert(VM_Version::supports_sve(), "should not call this");


and in `VM_Version::get_os_cpu_info()`:

-  if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE))   _features |= CPU_CRC32;
-  if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE))  _features |= CPU_AES | CPU_SHA1 | CPU_SHA2;
-  if (IsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE))        _features |= CPU_ASIMD;
+  if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)) {
+    set_feature(CPU_CRC32);
+  }
+
+  if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) {
+    set_feature(CPU_AES);
+    set_feature(CPU_SHA1);
+    set_feature(CPU_SHA2);
+  }
+
+  if (IsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE)) {
+    set_feature(CPU_ASIMD);
+  }

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

PR Comment: https://git.openjdk.org/jdk/pull/26515#issuecomment-3975052322


More information about the hotspot-dev mailing list