RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v22]
Vladimir Ivanov
vlivanov at openjdk.org
Fri Nov 7 23:20:33 UTC 2025
On Fri, 7 Nov 2025 10:34:18 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/reachability.cpp line 383:
>>
>>> 381: // Linearly traverse CFG upwards starting at n until first merge point.
>>> 382: // All encountered safepoints are recorded in safepoints list.
>>> 383: static void linear_traversal(Node* n, Node_Stack& worklist, VectorSet& visited, Node_List& safepoints) {
>>
>> The second comment line does not sound accurate, we don't collect ALL, only the candidates. Maybe we can find a better method name, and even remove that comment because of it?
>>
>> Given the more useful sub query `is_interfering_sfpt_candidate`, I think we could name this method something like `collect_interfering_sfpt_candidates`. Or is it very important that this is a linear traversal vs some other traversal we could choose from?
>
> Hmm, but this here is only a component of the `enumerate_interfering_sfpts` below, which has essencially that name.
>
> So maybe it should be `collect_interfering_sfpt_candidates_for_node` here and just `collect_interfering_sfpt_candidates` below?
I updated the comment and did some renaming.
`enumerate_interfering_sfpts_linear_traversal` computes the set of interfering safepoints for some RF node, not just candidates. It's only `is_interfering_sfpt_candidate()` which does some filtering ignoring the context (the RF node a safepoint can interfere with).
>> src/hotspot/share/opto/reachability.cpp line 409:
>>
>>> 407: visited.set(referent_ctrl->_idx); // end point
>>> 408:
>>> 409: Node_Stack stack(0);
>>
>> `ResouceMark`?
>
> We call this many times, so not sure if this could explode somehow?
It's hard to place a nested ResourceMark because there are dynamically reallocated data structures with different life cycles. Instead, I moved temporary data structure allocations up in the call chain and made them shared across all RF nodes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2505815482
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2505815512
More information about the hotspot-compiler-dev
mailing list