RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v22]
Emanuel Peter
epeter at openjdk.org
Fri Nov 7 11:13:33 UTC 2025
On Fri, 7 Nov 2025 10:43:54 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> src/hotspot/share/opto/reachability.cpp line 409:
>>
>>> 407: visited.set(referent_ctrl->_idx); // end point
>>> 408:
>>> 409: Node_Stack stack(0);
>>
>> Also: you now call it `stack` out here but `worklist` inside `linear_traversal`. I would use a consistent name.
>
> And why not use a `Unique_Node_List`, to unite the `visited` and `stack` into a single `worklist`?
Ah. Right, at first I did not see that you are using a stack, which id not a node list. It also has the idx.
In my experience, this usually creates code that is a little harder to read. I prefer using a `Unique_Node_List`, and then just traverse over all ctrl inputs, and add those to the worklist. You have to special case Region, and all other CFG nodes only have ctrl on `in(0)`. It tends to nicely flatten the whole BFS traversal into a small loop. But maybe it does use just a bit more memory than your traversal.
Just an idea, I can probably find a way to wrap my head around this approach here too ;)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2502821592
More information about the hotspot-compiler-dev
mailing list