RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v22]
Emanuel Peter
epeter at openjdk.org
Tue Nov 11 10:23:36 UTC 2025
On Fri, 7 Nov 2025 23:15:58 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> 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.
We already have something for node uses with `Node::visit_uses`. You could have a similar one for visiting inputs, and then limit to `CFG` nodes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25315#discussion_r2513651655
More information about the hotspot-compiler-dev
mailing list