RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v24]

Vladimir Ivanov vlivanov at openjdk.org
Thu Nov 13 02:19:13 UTC 2025


On Tue, 11 Nov 2025 11:22:15 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revise RF redunancy & auto-boxed primitives handling
>>   Cleanups
>
> src/hotspot/share/opto/reachability.cpp line 228:
> 
>> 226:       for (IdealLoopTree* outer_loop = lpt->_parent;
>> 227:            outer_loop->is_invariant(referent) && outer_loop->unique_loop_exit_or_null() != nullptr;
>> 228:            outer_loop = outer_loop->_parent) {
> 
> Out of curiosity: is it always desirable to move out as far as possible? Or are there downsides?

I'm not aware about any downsides. A use inside a loop keeps a value alive for the duration of the outermost loop where the value is loop invariant. So, the transformation is equivalent.

Alternatively, if only a single step is made each time, then on the next iteration the conditions will be met again. It's more optimal to do it all at once.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2520888266


More information about the hotspot-compiler-dev mailing list