RFR: 8315066: Add unsigned bounds and known bits to TypeInt/Long [v47]

Emanuel Peter epeter at openjdk.org
Wed Apr 30 15:40:09 UTC 2025


On Tue, 22 Apr 2025 16:34:36 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/rangeinference.cpp line 307:
>> 
>>> 305:     // violation, which is the last set bit of tmp
>>> 306:     //           0 1 1 0 0 0 0 0
>>> 307:     U tmp = ~either & find_mask;
>> 
>> Did I understand that right: `tmp` is the bits that we cannot flip? Or is it the ones we can flip? A better name would be appreciated :)
>> Same for `either`. worst case you call it `lo_or_zeros`... but that's not great either.
>> 
>> I'm not fully seeing through the logic here yet, so I struggle to make good suggestions.
>
> We can say that `tmp` is all the bits we can flip, although I think that is too ambiguous, what does "can" mean here. It is better to think of it as all the bits that are not lower than `first_violation` and are 0 in both `lo` and `zeros`.

Hmm ok. Well it would still be helpful to at least have some kind of intuition, and "name" for it. Are all these bits the candidates for `alignment`, of we must pick the one most to the right, i.e. so that we get the smallest `alignment` value?
And then why is it these bits, and not any others? An argument would be good here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17508#discussion_r2068935771


More information about the hotspot-compiler-dev mailing list