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

Dean Long dlong at openjdk.org
Fri Jan 26 20:19:39 UTC 2024


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

>> src/hotspot/share/c1/c1_Canonicalizer.cpp line 848:
>> 
>>> 846:       if (v == x->key_at(i)) {
>>> 847:         sux = x->sux_at(i);
>>> 848:         break;
>> 
>> Shouldn't we also break when `v < x->key_at(i) `, meaning no key will match?  Maybe we should consider binary search?
>
> Updated: break when `v < x->key_at(i)`
> 
>> Maybe we should consider binary search?
> 
> From the perspective of pursuing performance, binary search can be considered. If you agree, I can change to using binary search here.

Yes, I'd like to see how it looks.

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

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


More information about the hotspot-compiler-dev mailing list