RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v22]
Vladimir Ivanov
vlivanov at openjdk.org
Fri Nov 7 19:57:12 UTC 2025
On Fri, 7 Nov 2025 10:56:24 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 384:
>
>> 382: // All encountered safepoints are recorded in safepoints list.
>> 383: static void linear_traversal(Node* n, Node_Stack& worklist, VectorSet& visited, Node_List& safepoints) {
>> 384: for (Node* ctrl = n; ctrl != nullptr; ctrl = ctrl->in(0)) {
>
> This "fast-forwarding" looks a bit like an optimization. Why not just add all CFG nodes on the worklist, would that not simplify the graph a little? Or did you find a case where this was really important?
`linear_traversal` in `enumerate_interfering_sfpts` is an optimization for CFG traversal. Only Region nodes end up on worklist while the rest can be traversed in a linear fashion.
> Why not just add all CFG nodes on the worklist, would that not simplify the graph a little?
Then on each iteration you have to check for Region node and handle it specially. The perceived complexity just pops out in a different place. I started with a generic graph traversal version and then found it clearer to separate Region handling and avoid worklist for all the other CFG nodes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2505250129
More information about the hotspot-compiler-dev
mailing list