RFR: 8327093: Add slice function to BitMap API

Matias Saavedra Silva matsaave at openjdk.org
Mon Mar 4 21:46:20 UTC 2024


The BitMap does not currently have a "slice" method which can return a subset of the bitmap defined by a start and end bit. This utility can be used to analyze portions of a bitmap or to overwrite the existing map with a shorter, modified map. 

This implementation has two core methods: 
`copy_of_range` allocates and returns a new word array as used internally by BitMap
`truncate` overwrites the internal array with the one generated by `copy_of_range` so none of the internal workings are exposed to callers outside of BitMap.

-------------

Commit messages:
 - Adjusted assert
 - Added tests for CHeap and Arena
 - Improved test and corrected copy_of_range
 - 8327093: Add slice function to BitMap API

Changes: https://git.openjdk.org/jdk/pull/18092/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18092&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8327093
  Stats: 293 lines in 3 files changed: 291 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/18092.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18092/head:pull/18092

PR: https://git.openjdk.org/jdk/pull/18092


More information about the hotspot-dev mailing list