RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v22]
Vladimir Ivanov
vlivanov at openjdk.org
Fri Nov 7 23:20:34 UTC 2025
On Fri, 7 Nov 2025 11:01:24 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> 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 ;)
Unified naming.
> In my experience, this usually creates code that is a little harder to read.
Well, in my experience graph traversal implementation in C2 is way too verbose most of the time. I'd prefer a standard utility methods to traverse relevant parts of the graph, especially since we can use lambdas now. It would make it much easier to reason about it at use sites while making it more beneficial to invest into microoptimizations for different types of traversals.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2505815641
More information about the hotspot-compiler-dev
mailing list