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

Emanuel Peter epeter at openjdk.org
Wed Apr 30 15:11:07 UTC 2025


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

>> src/hotspot/share/opto/rangeinference.cpp line 84:
>> 
>>> 82: // Find the minimum value that is not less than lo and satisfies bits. If there
>>> 83: // does not exist one such number, the calculation will overflow and return a
>>> 84: // value < lo.
>> 
>> I'm wondering if we should say anything more specific for this case. Maybe at least an example? It should probably not go here at the beginning, but somewhere further down.
>
> What do you mean? It is the doc for `adjust_lo`, of course it needs to be here, I think it is logical to say what the function does before saying how it does it. For that purpose I think it is very clear already and an example is not needed.

@merykitty 
Hmm, I'm a little nervous about the case where `there does not exist one such number`. Because all your proof does is basically assume that there is such a `r`, and then shows that we compute it correctly.

But such proofs do not give us the guarantee that if there is no such `r`, that the computation indeed overflows, i.e. produces a number smaller than `lo`. That would be required for the correctness, no?

So I guess the proof / examples with overflow should happen further down, I'm just mentioning it up here because it is here that you say there can be an overflow. Hope that makes sense 🙈

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

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


More information about the hotspot-compiler-dev mailing list