[8u] RFR(S): 8244548: JDK 8u: sun.misc.Version.jdkUpdateVersion() returns wrong result
Andrew Hughes
gnu.andrew at redhat.com
Mon May 11 18:57:55 UTC 2020
On 11/05/2020 19:22, Simon Tooke wrote:
> That's horrible. I will try again. My wife claims I tell anecdotes
> like that too.
>
> Original:
>
> 1644 unsigned int jdk_version; /* Consists of major, minor, micro
> (n.n.n) */
> 1645 /* and build number
> (xx) */
> 1646 unsigned int update_version : 8; /* Update release
> version (uu) */
> 1647 unsigned int special_update_version : 8; /* Special update
> release version (c)*/
> 1648 unsigned int reserved1 : 16;
> 1649 unsigned int reserved2;
>
> The proposed patch:
>
> 1644 unsigned int jdk_version; /* Consists of major, minor, micro
> (n.n.n) */
> 1645 /* and build number
> (xx) */
> 1646 unsigned int update_version : 16; /* Update release
> version (uu) */
> 1647 unsigned int special_update_version : 8; /* Special update
> release version (c)*/
> 1648 unsigned int reserved1 : 16;
> 1649 unsigned int reserved2;
>
> Note that the original sum of bitfields is 32 bits, so it will fit into
> a 4 byte int (which it is surrounded by)
> The proposed sum of bitfields is 40 bits, which will probably cause a
> new 4 byte bitfield to be generated under the hood.
>
> -Simon
Thanks. That's a lot more readable :-)
Do we have any idea how much the three later fields are used in the
wild? In particular, could we not just steal those eight bits from
'special_update_version' (whatever that is) and keep the sum the same?
This would only apply to versions where update_version is broken
already, so reinterpretation of a structure of the existing size seems
safer than increasing the size by eight bits.
In code,
unsigned int jdk_version;
unsigned int update_version : 16;
unsigned int reserved1 : 16;
unsigned int reserved2;
or, if we're wary about losing the name special_update_version, we could
shrink reserved1:
unsigned int jdk_version;
unsigned int update_version : 16;
unsigned int special_update_version : 8;
unsigned int reserved1 : 8;
unsigned int reserved2;
Thanks,
--
Andrew :)
Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the jdk8u-dev
mailing list