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

Roland Westrelin roland at openjdk.org
Thu May 2 07:10:59 UTC 2024


On Thu, 18 Apr 2024 12:22:27 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/loopopts.cpp line 3783:
>> 
>>> 3781:             // ScopedValueGetLoadFromCache and companion ScopedValueGetHitsInCacheNode must stay together
>>> 3782:             move_scoped_value_nodes_to_not_peel(peel, not_peel, peel_list, sink_list, i);
>>> 3783:             incr = false;
>> 
>> Do we not have to increment the `cloned_for_outside_use`, which affects the `estimate`?
>
> Could we otherwise exhaust the node limit, by peeling a loop that is too large?

No node is cloned here so there's no need to adjust the `estimate`. What happens is that a `ScopedValueGetHitsInCacheNode` is in the peeled region of the loop but not its `ScopedValueGetLoadFromCache` because peeling happens right above the `If` for the `ScopedValueGetHitsInCacheNode` . It's correct to simply move the `ScopedValueGetHitsInCacheNode`  out of the peeled region into the non peeled region because it's only used there.

There was no test case for this. I added one.

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

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


More information about the hotspot-compiler-dev mailing list