JDK-8186579 : VM_Version::platform_features() needs update on linux-sparc
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 10
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • CPU: sparc
  • Submitted: 2017-08-22
  • Updated: 2019-05-22
  • Resolved: 2017-11-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Resolved
Related Reports
Duplicate :  
Description
Trying to build the standard server variant on linux-sparc currently fails with:

=== Output from failing command(s) repeated here ===
/usr/bin/printf "* For target hotspot_variant-server_libjvm_objs_vm_version_linux_sparc.o:\n" 
* For target hotspot_variant-server_libjvm_objs_vm_version_linux_sparc.o:
(/bin/grep -v -e "^Note: including file:" <  /home/glaubitz/openjdk/hs/build/linux-sparcv9-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_vm_version_linux_sparc.o.log || true) | /usr/bin/head -n 12 
/home/glaubitz/openjdk/hs/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp:65:5: error: prototype for ���int VM_Version::platform_features(int)��� does not match any in class ���VM_Version���
 int VM_Version::platform_features(int features) {
     ^~~~~~~~~~
In file included from /home/glaubitz/openjdk/hs/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp:28:0:
/home/glaubitz/openjdk/hs/hotspot/src/cpu/sparc/vm/vm_version_sparc.hpp:196:15: error: candidate is: static void VM_Version::platform_features()
   static void platform_features();
               ^~~~~~~~~~~~~~~~~
/home/glaubitz/openjdk/hs/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp:61:13: warning: ���bool detect_blkinit()��� defined but not used [-Wunused-function]
 static bool detect_blkinit() {
             ^~~~~~~~~~~~~~
/home/glaubitz/openjdk/hs/hotspot/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp:57:13: warning: ���bool detect_M_family()��� defined but not used [-Wunused-function]
 static bool detect_M_family() {
if test `/usr/bin/wc -l < /home/glaubitz/openjdk/hs/build/linux-sparcv9-normal-server-release/make-support/failure-logs/hotspot_variant-server_libjvm_objs_vm_version_linux_sparc.o.log` -gt 12; then /bin/echo "   ... (rest of output omitted)" ; fi 
   ... (rest of output omitted)
/usr/bin/printf "\n* All command lines available in /home/glaubitz/openjdk/hs/build/linux-sparcv9-normal-server-release/make-support/failure-logs.\n" 

* All command lines available in /home/glaubitz/openjdk/hs/build/linux-sparcv9-normal-server-release/make-support/failure-logs.
/usr/bin/printf "=== End of repeated output ===\n" 
=== End of repeated output ===

This happens because VM_Version::platform_features() recently changed its signature from "int platform_features(int)" to "void platform_features()" on solaris-sparc. And since the signature has to match on both solaris-sparc and linux-sparc, the function needs to be updated for linux-sparc.

A minimalist fix for this issue is very simple:

diff -r eed8aa5e12df src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp
--- a/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp      Tue Aug 22 08:37:17 2017 -0400
+++ b/src/os_cpu/linux_sparc/vm/vm_version_linux_sparc.cpp      Tue Aug 22 18:28:10 2017 +0300
@@ -62,23 +62,8 @@
   return cpuinfo_field_contains("cpucaps", "blkinit");
 }
 
-int VM_Version::platform_features(int features) {
-  // Default to generic v9
-  features = generic_v9_m;
-
-  if (detect_niagara()) {
-    log_info(os, cpu)("Detected Linux on Niagara");
-    features = niagara1_m | T_family_m;
-  }
+void VM_Version::platform_features() {
+  uint64_t features = ISA_v9_msk;   // Basic SPARC-V9 required (V8 not supported).
 
-  if (detect_M_family()) {
-    log_info(os, cpu)("Detected Linux on M family");
-    features = sun4v_m | generic_v9_m | M_family_m | T_family_m;
-  }
-
-  if (detect_blkinit()) {
-    features |= blk_init_instructions_m;
-  }
-
-  return features;
+  _features = features;
 }

However, this way, platform_features() will just always report the machine to be sparcv9 without being able to report additional, individual CPU features.

I am currently working on a patch which will also report additional CPU features so platform_features() on linux-sparc will have similar functionality as on solaris-sparc.
Comments
If fixed by another issue this issue must be closed as a duplicate. The Fixed status is reserved for issues for which a changeset has been pushed. Thanks.
02-11-2017

This has just been resolved in JDK-8172232.
02-11-2017

Attaching an initial version of the patch. It's still not on par with the Solaris version but at least it fixes the build and is an overall improvement.
24-08-2017