On Mon, 8 Dec 2025 11:27:09 GMT, Tobias Hartmann <[email protected]> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Should not clone MergeMem
>
> src/hotspot/share/ci/ciObjArrayKlass.cpp line 201:
> 
>> 199:     ciInstanceKlass* ik = base->as_instance_klass();
>> 200:     // Even though MyValue is final, [LMyValue is only exact if the 
>> array
>> 201:     // is null-free due to null-free [LMyValue <: null-able [LMyValue.
> 
> There are some more occurrences of `// Even though MyValue is final, 
> [LMyValue is only exact if the array` in the code, should those be updated as 
> well?

I did not touch those places yet, so I have not updated those comments, I will 
clean those up in follow-up PRs.

> src/hotspot/share/opto/compile.cpp line 1485:
> 
>> 1483:               cast_to_ptr_type(TypePtr::BotPTR)->
>> 1484:               cast_to_exactness(false)->
>> 1485:               with_offset(offset);
> 
> These changes are difficult to review because it's not immediately clear what 
> changed semantically. For example, where did this line go?

Yeah, it is pretty messy, this particular part canonicalizes the `TypeAryPtr` 
to `TypePtr::BotPTR`, `klass_is_exact == false`, `speculative == nullptr` if:

- `ptr()` is `NotNull`
- `klass_is_exact == true`, this includes `ptr() == Constant`, which means that 
it also erases `Constant` to `BotPTR`
- `speculative != nullptr`

As a result, it effectively erases `NotNull` and `Constant` to `BotPTR`, 
removes `speculative`, and tries casting the array to `klass_is_exact == 
false`. It is trivial that the refactored version does the first 2 actions, for 
casting the array to `klass_is_exact == false`, the new version does it for 
arrays of oops, primitive arrays are always `klass_is_exact`, and flat arrays 
is also `klass_is_exact`.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1755#discussion_r2598709229
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1755#discussion_r2598702135

Reply via email to