RFR: 8304759: Add BitMap iterators [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Wed Mar 29 09:34:22 UTC 2023
On Wed, 29 Mar 2023 09:22:33 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>>
>> better names for step functions
>
> src/hotspot/share/utilities/bitMap.hpp line 420:
>
>> 418: // Returns the index of the last set bit in the remaining iteration range.
>> 419: // precondition: !is_empty()
>> 420: idx_t last() const;
>
> The comments for `first()` and `last()` are a little misleading. The invariant that the `first()`/`last()` is a set bit is only true for `first()` in the forward iterator and for `last()` in the reverse iterator.
>
> It seems more like a contract that if you use `first()` then you must have created `IteratorImpl(const BitMap* map, idx_t beg, idx_t end)` with `beg` being a set bit. And if you use `last()` then you must have created it with `end` being a set bit.
Or `beg == end`, that is an `is_empty()` Iterator
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13184#discussion_r1151653215
More information about the hotspot-dev
mailing list