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

Emanuel Peter epeter at openjdk.org
Thu May 1 09:49:03 UTC 2025


On Thu, 1 May 2025 08:54:46 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - new_hi computation
>>  - refer back to the formality section
>>  - clarify where overflow comes from
>
> src/hotspot/share/opto/rangeinference.cpp line 670:
> 
>> 668:   if (i1 == t2 || t2 == Type::TOP) {
>> 669:     return i1;
>> 670:   }
> 
> Not sure if I got this right, I'm not fully understanding what the `dual` flag does here yet.
> Is this correct?
> `meet = intersection` - `dual = false`
> `join = union` - `dual = true`
> 
> So if `i1 == t2`, then we can return `i1` in both cases, as it is both the intersection and union.
> But if `t2 == Type::TOP`, and `i1` is not TOP, then `i1` is not the intersection.
> 
> What am I missing?

If this is  indeed a bug, we need a test case to catch it :)

> src/hotspot/share/opto/rangeinference.cpp line 678:
> 
>> 676:                                          {MIN2(i1->_ulo, i2->_ulo), MAX2(i1->_uhi, i2->_uhi)},
>> 677:                                          {i1->_bits._zeros & i2->_bits._zeros, i1->_bits._ones & i2->_bits._ones}},
>> 678:                   MAX2(i1->_widen, i2->_widen), false);
> 
> Ok, this looks like a union. And below like a intersection.

Why do you handle the `widen` differently here?

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

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


More information about the hotspot-compiler-dev mailing list