[8u] RFR(S): 8244548: JDK 8u: sun.misc.Version.jdkUpdateVersion() returns wrong result

Simon Tooke stooke at redhat.com
Mon May 11 18:22:42 UTC 2020


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

On 2020-05-11 1:38 p.m., Andrew Hughes wrote:
>
> On 07/05/2020 16:55, Simon Tooke wrote:
>> (disclaimer: I am not a reviewer)
>>
>>
>> I believe it's a "good thing" to shrink the reserved1 bitfield, as I
>> suspect the entire struct grows by 4 bytes otherwise.
>>
>>
>> Original:
>>
>> 644 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: 44 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
>>
>>
> I don't know what happened here, but this is nearly impossible to read
> as one unbroken line of text. Can you add some line breaks?
>
> Thanks,



More information about the jdk8u-dev mailing list