RFR: 8251322: Improve BitMap::iterate
Kim Barrett
kim.barrett at oracle.com
Mon Aug 10 07:18:45 UTC 2020
> On Aug 10, 2020, at 12:24 AM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Kim,
>
> On 9/08/2020 5:44 pm, Kim Barrett wrote:
>> Please review this improvement to BitMap::iterate. The code is both
>> simplified and made more performant by using get_next_one_bit to scan
>> the bitmap. Making it inline may allow the compiler to devirtualize
>> and possibly inline the closure invocation. These changes result in
>> some configurations executing ~1M fewer instructions during startup.
>> CR:
>> https://bugs.openjdk.java.net/browse/JDK-8251322
>> Webrev:
>> https://cr.openjdk.java.net/~kbarrett/8251322/open.00/
>
> The new code looks much clearer and simpler! Only one minor comment.
> The old code clearly documents the range as being right-open, whereas this:
>
> // Iteration support. Applies the closure to the index for each set bit,
> // starting from the least index in the range to the greatest, in order.
>
> does not clearly state so.
Throughout this class, ranges are half-open on the right. That isn’t always stated
explicitly in description comments though. There’s even a verify_range function.
There was some discussion a while ago about cleaning up some of the nomenclature
and descriptions, but I haven’t gotten back to that yet.
I’ve added “// precondition: beg and end form a valid range.” to the iterate description.
More information about the hotspot-dev
mailing list