RFR: 8365205: C2: Optimize popcount value computation using knownbits [v11]

Jatin Bhateja jbhateja at openjdk.org
Mon Sep 29 17:15:26 UTC 2025


On Thu, 25 Sep 2025 21:22:30 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update countbitsnode.cpp
>
> src/hotspot/share/opto/countbitsnode.cpp line 124:
> 
>> 122: // From the definition of KnownBits, we know:
>> 123: //   zeros: Indicates which bits must be 0: zeros[i]=1 -> t[i]=0
>> 124: //   ones:  Indicates which bits must be 1: ones[i]=1 -> t[i]=1
> 
> I don't think we should duplicate the information available in rangeinference.hpp - we should enhance the documentation there, such as noting `~zeros` is the number where the maximum number of bits are set to 1, to help comprehension.
> 
> If we know `ones` is `min_ones` and `~zeros` is `max_ones`, we can easily derive that `pop_count(ones) <= pop_count(t) <= pop_count(~zeros)`

Hi @liach , There couple of lines used to complete the context. As you rightly pointed out, we do have very discriptive comments in rangeinference.hpp.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27075#discussion_r2388671254


More information about the core-libs-dev mailing list