On Tue, 30 Jun 2026 16:08:26 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:
>> 
>> - [x] 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).
>
> Quan Anh Mai has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains two commits:
> 
>  - Merge branch 'lworld' into asinstancetype
>  - Refactor cast_to_exactness(false)->as_instance_type()

Thanks a lot for your review.

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

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

Reply via email to