On Tue, 23 Jun 2026 15:29:49 GMT, Quan Anh Mai <[email protected]> wrote:

>> Christian Hagedorn has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   improve checks and further refactor exclude_flat to make it easier to read
>
> src/hotspot/share/opto/library_call.cpp line 5199:
> 
>> 5197:     const TypeAryPtr* orig_t = _gvn.type(original)->isa_aryptr();
>> 5198:     const TypeAryKlassPtr* dest_klass_t = 
>> _gvn.type(klass_node)->is_klassptr()->isa_aryklassptr();
>> 5199:     const bool can_src_be_abstract_flat_value_class_array = orig_t != 
>> nullptr && !orig_t->elem()->is_inlinetypeptr() && !orig_t->is_not_flat();
> 
> This name is a little misleading, I think you want to catch the case `orig_t 
> == nullptr` below, but if the static type is `j.l.O`, the runtime type can 
> still be an abstract flat array.

That's true. Though, I'm wondering if `orig_t` could even be a non-array 
pointer at all. The `Arrays.copyOf()` takes a `U[]`, so after type erasure, we 
should know it's an `Object[]` and thus have an array 
pointer. It looks like the original code was just defensive by checking 
`orig_t` as well. I removed it and testing passed.

> src/hotspot/share/opto/library_call.cpp line 5200:
> 
>> 5198:     const TypeAryKlassPtr* dest_klass_t = 
>> _gvn.type(klass_node)->is_klassptr()->isa_aryklassptr();
>> 5199:     const bool can_src_be_abstract_flat_value_class_array = orig_t != 
>> nullptr && !orig_t->elem()->is_inlinetypeptr() && !orig_t->is_not_flat();
>> 5200:     const bool can_dest_be_value_class_array = dest_klass_t != nullptr 
>> && dest_klass_t->can_be_inline_array();
> 
> What if `dest` is not an `aryklassptr`? I think in that case this should also 
> be true, right?

See general comment sent above.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2569#discussion_r3504231268
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2569#discussion_r3504475352

Reply via email to