RFR: 8315066: Add unsigned bounds and known bits to TypeInt/Long [v62]
Emanuel Peter
epeter at openjdk.org
Mon May 5 13:16:09 UTC 2025
On Mon, 5 May 2025 11:47:17 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> src/hotspot/share/opto/rangeinference.cpp line 480:
>>
>>> 478: if (h < ~bounds._hi) {
>>> 479: return AdjustResult<RangeInt<U>>::make_empty();
>>> 480: }
>>
>> Another nit: I feel like the "overflow" case here would not have to spill outside of `adjust_lo`.
>> And `Optional` style return value would make more sense for the reader at this point, then the reader does not have to worry about why we do a comparison here, and does not have to dive deeper into `adjust_lo`.
>>
>> I leave this up to you though.
>
> That's a good point, however I think I will do this later as we don't have an `Optional` in Hotspot yet.
Oh, you basically already defined "Optional" whenever you have a `_present` flag.
>> src/hotspot/share/utilities/intn_t.hpp line 44:
>>
>>> 42: // Implementation-wise, this class currently only supports 0 < nbits <= 8. Also
>>> 43: // note that this class is implemented so that overflows in alrithmetic
>>> 44: // operations are well-defined and wrap-around.
>>
>> Suggestion:
>>
>> // operations are well-defined and wrap-around, just like jint, juint, jlong and julong.
>
> Overflow in `jint` and `jlong` is actually UB.
Ah right. Only well defined with `java_add` etc.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17508#discussion_r2073421714
PR Review Comment: https://git.openjdk.org/jdk/pull/17508#discussion_r2073420231
More information about the hotspot-compiler-dev
mailing list