RFR: 8320649: C2: Optimize scoped values [v4]

Emanuel Peter epeter at openjdk.org
Tue Jan 30 12:59:45 UTC 2024


On Tue, 30 Jan 2024 12:13:47 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> src/hotspot/share/opto/loopnode.cpp line 4717:
>> 
>>> 4715:   assert(!_igvn.delay_transform(), "");
>>> 4716:   _igvn.set_delay_transform(true);
>>> 4717:   for (uint i = _scoped_value_get_nodes.size(); i > 0; i--) {
>> 
>> Suggestion:
>> 
>>   for (uint i = _scoped_value_get_nodes.size()-1; i >= 0; i--) {
>
> An unsigned value is always `>= 0`. Wouldn't your suggestion turn the loop into an infinite loop?

And does it need to be a `uint`? It seems you are really using `i-1`, and never `i` directly. It would be nicer to name the thing you are actually using.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16966#discussion_r1471162405


More information about the hotspot-compiler-dev mailing list