JDK-8357805 : C2: OpaqueDelayNode: arbitrarily delay IGVN optimizations
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 25,26
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-05-26
  • Updated: 2025-05-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
Implement a debug Java class, with methods that are identity functions, i.e. have a single input and directly output that value.

DebugClass::identity(int) -> int
DebugClass::identity(long) -> long
...

Intrinsify the "identity" methods, and turn it into a OpaqueDelayNode. At first, keep it Opaque, i.e. the output type is the bottom_type. Once the input is narrower, we could also narrow the output value, but we don't have to. We can randomize this, and narrow or even remove the node completely.

This has the effect of artificially delaying constant folding and other IGVN transformations. Maybe this triggers bugs where we did not properly notify all necessary outputs. Or maybe something wrongly optimizes, etc.

In the end, we can remove the nodes in the last IGVN round, or just create a backend identity operation.

I would start with simple cases like primitive types such as int, long, float, etc.

Later we could also consider objects.

One idea is to add such nodes randomly into the graph, but that could lead to unexpected results, as some patterns may not be expected. And data/ctrl flow may get out of balance. Therefore, I would just keep it as a intrinsified Java method, which we can add just like any other arithmetic operation.

This could help us reproduce notification issues, and other constant folding issues. We can use it manually, or through fuzzers (e.g. Templates).