RFR: 8290892: C2: Intrinsify Reference.reachabilityFence [v24]

Vladimir Ivanov vlivanov at openjdk.org
Sat Nov 15 02:28:57 UTC 2025


On Fri, 14 Nov 2025 15:28:23 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>>> You have a few tests already, but I'd love to see some IR tests. You could even check for the presence of ReachabilityFenceNode during some phase and then see if it goes away. Nice would be if we could even track if a SafePoint has a RF edge attached, but not sure how easy that is.
>>> It would allow us not only to check for correctness, and hoping that we would catch incorrect cases with a crash/wrong result. But it would allow us to verify the graph, including the optimizations.
>> 
>> The main complications with IR tests I see are:
>>   (1) very few cases where RF node is missing are known and all of them have already have a dedicated regression test;
>>   (2) the invariants RF imposes on the graph are non-local and it's hard to check them by inspecting IR.
>> 
>> There's the transformation for loop-invariant referent I could try to add an IR unit test for, but I don't know how suitable IR test framework is for such scenario.
>> 
>> Overall, I'd prefer to leave it as is for now and explore opportunities for IR tests as part of general effort to improve RF test coverage.
>
> @iwanowww I suppose adding more IR tests now would ensure that the implementation you are now adding does exactly what we expect, and not something different that just happens to behave correct.
> 
> Examples would also help for the review. We have quite a machinery here, and understanding how the steps come together would be great. So it would be nice if you could annotate the tests we already do have: what do you expect happens to the RF's, the reference, the SafePoints, and the other relevant nodes? Maybe we can then turn some of those annotations into IR nodes right away, and some are probably too difficult.
> 
> But I do see that the current regex matching on single IR nodes is a bit tricky here. It only allows you to detect the presence of a `ReachabilityFence` node, but not where it is and what it's connected to. This could be a motivation for extending the IR framework to allow some kind of graph matching. Though I do see that this could get quite complex.

@eme64 I added IR tests for the test cases in `compiler/c2/TestReachabilityFence.java`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25315#issuecomment-3535424171


More information about the hotspot-compiler-dev mailing list