RFR: 8324630: C1: Canonicalizer::do_LookupSwitch doesn't break the loop when the successor is found [v3]

Dean Long dlong at openjdk.org
Sat Jan 27 02:30:34 UTC 2024


On Fri, 26 Jan 2024 22:47:46 GMT, Denghui Dong <ddong at openjdk.org> wrote:

>> Hi,
>> 
>> Please review the small change that breaks the loop in Canonicalizer::do_LookupSwitch if the successor is found.
>> 
>> The keys of LookupSwitch are sorted, so there is no need to continue the loop once matched.
>> 
>> Thanks.
>
> Denghui Dong has updated the pull request incrementally with one additional commit since the last revision:
> 
>   binary search

src/hotspot/share/c1/c1_Canonicalizer.cpp line 848:

> 846:     int high = x->length() - 1;
> 847:     while (low <= high) {
> 848:       int mid = low + ((high - low) >> 1);

Isn't this the same as
`int mid = (low + high) >> 1;`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17553#discussion_r1468281722


More information about the hotspot-compiler-dev mailing list