On Tue, 30 Jun 2026 08:08:45 GMT, Quan Anh Mai <[email protected]> wrote:

> Hi,
> 
> It turns out this issue has been fixed by @marc-chevalier. However, after 
> thinking about this issue, I find that the pattern we use 
> `cast_to_exactness(false)->as_instance_type()` to obtain the `Type` of an oop 
> that subtypes a klass pointer is flawed. This is because in the `Type` 
> lattice, `cast_to_exactness` works in the `ciType` dimension, while we also 
> need to handle the `_refined_type` dimension when trying to perform that 
> action.
> 
> To be specific, in this issue, we have a klass pointer of unrefined arrays 
> that subtype `Object[]`, `cast_to_exactness` finds that this `TypeKlassPtr` 
> is already inexact, and return it as is. This is problematic, because there 
> is no instance for an unrefined array klass, and `as_instance_type` is 
> confused. @marc-chevalier solves the issue by walking around this issue, and 
> assume when the klass pointer is unrefined, we really mean obtaining the 
> instance that subtypes the pointer, not just those with the same type.
> 
> This PR does not actually solve the issue, I just refactored it, so the use 
> sites work in a more rigourous manner, we can fix the implementation after 
> Valhalla being merged.
> 
> Testing:
> 
> - [ ] tier1-4,valhalla-comp-stress
> 
> Please take a look and leave your reviews, thanks a lot.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Makes sense, thanks for the clarification!

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

PR Comment: https://git.openjdk.org/valhalla/pull/2598#issuecomment-4844862169

Reply via email to