JDK-8371506 : [lworld] TypeAryKlassPtr::cast_to_refined_array_klass_ptr looks suspicious
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-11-08
  • Updated: 2025-11-10
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
repo-valhallaUnresolved
Related Reports
Relates :  
Description
I wonder what this method is trying to do. This method only does something if `klass_is_exact` is true. But in that case, the TypeAryKlassPtr is a constant already. Should `exact_klass` return the correct ciKlass?

I believe there are 2 problems here:

- It may create a nonsensical ciKlass (a non-atomic nullable array).
- A TypeAryKlassPtr generally does not have a ciKlass, it only has that field for primitive arrays to differentiate boolean[], byte[], short[], char[], int[]. This fact is also kind of necessary, because there is no way to decide which would be the ciKlass for different kinds of T[] since there is no relationship between the nullable T[] and the null-restricted T[], especially if the type is not a constant. For arrays of value types, we also have different kinds of atomic refined types, too.
Comments
With the array metadata re-work, see JDK-8366705 (and JDK-8366668 / JDK-8370341), we now need to distinguish between the refined array klass (refArrayKlass or flatArrayKlass) and the non-refined objArrayKlass in C2's type system. TypeAryKlassPtr::cast_to_refined_array_klass_ptr is supposed to convert between the two, 'TypeAryKlassPtr::_refined_type' then keeps track of which one should be used.
10-11-2025