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

Vladimir Ivanov vlivanov at openjdk.org
Fri Nov 7 19:36:23 UTC 2025


On Fri, 7 Nov 2025 11:36:07 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   update
>
> src/hotspot/share/opto/reachability.cpp line 437:
> 
>> 435: // All RFs are replaced with edges from corresponding referents to interfering safepoints.
>> 436: // Interfering safepoints are safepoint nodes which are reachable from the RF to its referent through CFG.
>> 437: bool PhaseIdealLoop::eliminate_reachability_fences() {
> 
> Why not call it `migrate_reachability_fences_to_safepoints`? Because you are not really eliminating them, just shifting the edges, right?

`eliminate_reachability_fences()` means `eliminate_reachability_fence_nodes()`. 
We do eliminate reachability fences, but replace it with a safepoint-attached representation which is not equivalent (it's a lossy transformation).

Remember: all initial reachability invariants hold right after parsing phase (all interfering safepoints have all corresponding referents as part of their debug info), but subsequent optimizations can break them. Once RF nodes are gone, it's not safe to perform the same level of optimizations anymore. So, if we migrate to safepoint-attached representation too early, it can reintroduce the problem we are trying to fix with this PR.  

I can call it `expand_reachability_fence_nodes()` (akin to macro node expansion) if you find it less confusing.

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

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


More information about the hotspot-compiler-dev mailing list