RFR: 8324649: Shenandoah: refactor implementation of free set [v32]

Roman Kennke rkennke at openjdk.org
Wed Apr 10 11:54:18 UTC 2024


On Wed, 20 Mar 2024 19:51:48 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 46:
>> 
>>> 44: }
>>> 45: 
>>> 46: size_t ShenandoahSimpleBitMap::count_leading_ones(ssize_t start_idx) const {
>> 
>> Are you sure that you can't use the BitMap class in src/hotspot/share/utilities/bitMap.*? Or maybe only src/hotspot/share/utilities/count_leading_zeros.hpp or src/hotspot/share/utilities/count_trailing_zeros.hpp? That would emit CPU instructions that do the counting really fast, if possible. I.e. reverse all bits after loading, then find leading/trailing zeros, problem solved real fast. I would even argue to augment the BitMap class with count_* methods as needed, using the CPU-optimized routines.
>
> I will see if I can exploit the services in src/hotspot/share/utilities to improve performance.

Why use ssize_t for start_idx? or, at all? In bitMap.hpp, it declares a 'typedef size_t idx_t' and use that for bit and word indices. I'd try to stick to the same pattern as much as reasonably possible.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17561#discussion_r1559267896


More information about the hotspot-gc-dev mailing list