RFR: 8303621: BitMap::iterate should support lambdas and other function objects [v5]
Kim Barrett
kbarrett at openjdk.org
Tue Mar 7 13:04:03 UTC 2023
> Please review this enhancement of BitMap::iterate to support lambdas and other
> function objects as the operation being applied to the set bit indices. Some
> for-loops using BitMap::get_next_one_offset have been changed to use
> BitMap::iterate with a lambda.
>
> (One reason for changing the for-loops is that I'm considering a change to the
> get_next_one_offset API, and reducing the number of direct uses will simplify
> that.)
>
> For convenience, the function can either return void (always iterate over the
> whole range) or bool (stop iteration if returns false). Iteration using
> closure objects invoked via a do_bit member function are now implemented by
> being wrapped in a lambda, so get the same convenience. (Though, of course,
> if the closure is derived from BitMapClosure then do_bit returns bool.)
>
> The unit tests are written as "early" tests, not requiring an initialized VM.
> They also avoid any C heap allocation (even though C heap allocation has very
> early support). This is done to minimize the requirements for running the
> tests, since BitMap is used in a lot of places. This attempts to run these
> tests before uses. (Yes, I know about JDK-8257226; maybe that will be fixed
> someday.) (Some existing BitMap gtests should be modified to do similarly; see
> JDK-8303636.)
>
> Testing:
> mach5 tier1-7
Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
- Merge branch 'master' into lambda-iterate
- convert to bool rather than calling RT::operator!
- stefank review
- Merge branch 'master' into lambda-iterate
- improve description of iterate
- use iterate with lambda
- bitmap iteration supports lambda
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12876/files
- new: https://git.openjdk.org/jdk/pull/12876/files/83de109a..83f8c567
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12876&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12876&range=03-04
Stats: 85 lines in 3 files changed: 83 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/12876.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12876/head:pull/12876
PR: https://git.openjdk.org/jdk/pull/12876
More information about the hotspot-dev
mailing list