RFR: 8235551: BitMap::count_one_bits should use population_count
Kim Barrett
kim.barrett at oracle.com
Tue Dec 10 22:23:00 UTC 2019
> On Dec 8, 2019, at 4:54 PM, Claes Redestad <claes.redestad at oracle.com> wrote:
>
> Hi,
>
> with some adjustments, BitMap::count_one_bits can be rewritten to use
> the population_count utility method introduced in JDK-8217519
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8235551
> Webrev: http://cr.openjdk.java.net/~redestad/8235551/open.00/
>
> This generalizes population_count to accept any unsigned integer, to
> accommodate that BitMap will use 32- or 64-bit integers depending on
> platform.
Looks good.
This comment is a bit misleading:
src/hotspot/share/utilities/population_count.hpp
37 // Adapted from Hacker's Delight, 2nd Edition, Figure 5-2.
The implementation being used is a combination of that in Figure 5-2
and another version a bit later in the associated text. I suggest
changing the comment to say
Adapted From Hacker's Delight, 2nd Edition, Figure 5-2 and the text
that follows.
That way, someone looking up the reference won't just go "Wait, what?
That isn't what's in 5-2."
There are also a couple of pre-existing issues with
BitMap::count_one_bits which are not being addressed here:
https://bugs.openjdk.java.net/browse/JDK-8235714
https://bugs.openjdk.java.net/browse/JDK-8235715
More information about the hotspot-dev
mailing list