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

Roland Westrelin roland at openjdk.org
Mon Jan 29 13:43:40 UTC 2024


On Wed, 17 Jan 2024 11:18:36 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   merge fix
>
> src/hotspot/share/opto/callGenerator.cpp line 1031:
> 
>> 1029:       CallStaticJavaNode* get_first_iff_unc = get_first_iff_failure->is_uncommon_trap_proj(Deoptimization::Reason_none);
>> 1030:       if (get_first_iff_unc != nullptr) {
>> 1031:         // first cache check never hits, keep only the second.
> 
> I'm struggling to understand:
> We still have an unc-trap for the first. So we never failed so far, right? So we always found it in the cache, or am I wrong?
> We are not removing this unc-trap though, right?

The `ScopedValue.get()` codee probes 2 cache locations. If, when pattern matching the `get()` subgraph:

- we only find a single if that probes the cache, then, according to profile data, there was always a hit at the first cache location.

- we find 2 ifs, then the first and second locations were probed. If the first if's other branch is to an uncommon trap, then that location never saw a cache hit. In that case, when the `ScopedValueGetHitsInCacheNode` is expanded, only code to probe the second location is added back to the IR.

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

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


More information about the hotspot-compiler-dev mailing list