RFR: 8178352: BitMap::get_next_zero_offset may give wrong result on Mac

Kim Barrett kim.barrett at oracle.com
Mon Apr 10 16:18:29 UTC 2017


> On Apr 10, 2017, at 3:44 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
> 
> Hi Kim,
> 
> On 2017-04-10 00:00, Kim Barrett wrote:
>> Please review this change to BitMap::get_next_zero_offset_inline to
>> remove its use of left_n_bits, thereby avoiding
>> https://bugs.openjdk.java.net/browse/JDK-8178348.
>> 
>> CR:
>> https://bugs.openjdk.java.net/browse/JDK-8178352
>> 
>> Webrev:
>> http://cr.openjdk.java.net/~kbarrett/8178352/hotspot.00/
> 
> 
> The bug fix looks good.

Thanks.

> You did a couple of stylistic changes that now make the code inconsistent:
> 
> -    for (; res & 1; res_offset++) {
> -      res = res >> 1;
> 
> +    for (; (res & 1) == 0; ++res_offset) {
> +      res >>= 1;
> 
> 
> But the surrounding code uses this format:
> 271     for (; !(res & 1); res_offset++) {
> 272       res = res >> 1;
> 273     }
> 
> I think these changes should be kept out of this patch.

Post-decrement in for loops still makes me twitch, even though it doesn’t matter
in this code base.  But okay.




More information about the hotspot-dev mailing list