changeset 5882:361c433d4c90

8244548: JDK 8u: sun.misc.Version.jdkUpdateVersion() returns wrong result Reviewed-by: aph, andrew
author sgehwolf
date Wed, 06 May 2020 21:03:44 +0200
parents 6c86dbb5e66b
children debb29130706
files src/share/vm/prims/jvm.h src/share/vm/runtime/java.hpp src/share/vm/runtime/vm_version.cpp
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/jvm.h	Tue Jul 21 03:18:33 2020 +0100
+++ b/src/share/vm/prims/jvm.h	Wed May 06 21:03:44 2020 +0200
@@ -1582,9 +1582,9 @@
 } jvm_version_info;
 
 #define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
-#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
+#define JVM_VERSION_MINOR(version) ((version & 0x00FFFF00) >> 8)
 // Micro version is 0 in HotSpot Express VM (set in jvm.cpp).
-#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
+#define JVM_VERSION_MICRO(version) 0
 /* Build number is available in all HotSpot Express VM builds.
  * It is defined in make/hotspot_version file.
  */
@@ -1597,9 +1597,9 @@
     // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
     unsigned int jdk_version;   /* Consists of major, minor, micro (n.n.n) */
                                 /* and build number (xx) */
-    unsigned int update_version : 8;         /* Update release version (uu) */
+    unsigned int update_version : 16;        /* Update release version (uu) */
     unsigned int special_update_version : 8; /* Special update release version (c)*/
-    unsigned int reserved1 : 16;
+    unsigned int reserved1 : 8;
     unsigned int reserved2;
 
     /* The following bits represents new JDK supports that VM has dependency on.
--- a/src/share/vm/runtime/java.hpp	Tue Jul 21 03:18:33 2020 +0100
+++ b/src/share/vm/runtime/java.hpp	Wed May 06 21:03:44 2020 +0200
@@ -85,7 +85,7 @@
   uint8_t _major;
   uint8_t _minor;
   uint8_t _micro;
-  uint8_t _update;
+  uint16_t _update;
   uint8_t _special;
   uint8_t _build;
 
@@ -121,7 +121,7 @@
                   _pending_list_uses_discovered_field(false) {}
 
   JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t micro = 0,
-              uint8_t update = 0, uint8_t special = 0, uint8_t build = 0,
+              uint16_t update = 0, uint8_t special = 0, uint8_t build = 0,
               bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false,
               bool pending_list_uses_discovered_field = false) :
       _major(major), _minor(minor), _micro(micro), _update(update),
@@ -145,7 +145,7 @@
   uint8_t major_version() const          { return _major; }
   uint8_t minor_version() const          { return _minor; }
   uint8_t micro_version() const          { return _micro; }
-  uint8_t update_version() const         { return _update; }
+  uint16_t update_version() const        { return _update; }
   uint8_t special_update_version() const { return _special; }
   uint8_t build_number() const           { return _build; }
 
--- a/src/share/vm/runtime/vm_version.cpp	Tue Jul 21 03:18:33 2020 +0100
+++ b/src/share/vm/runtime/vm_version.cpp	Wed May 06 21:03:44 2020 +0200
@@ -267,7 +267,7 @@
 
 unsigned int Abstract_VM_Version::jvm_version() {
   return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) |
-         ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) |
+         ((Abstract_VM_Version::vm_minor_version() & 0xFFFF) << 8) |
          (Abstract_VM_Version::vm_build_number() & 0xFF);
 }