[lworld] RFR: 8372113: [lworld] Fix various issues with TypeAryPtr and TypeAryKlassPtr [v7]
Tobias Hartmann
thartmann at openjdk.org
Thu Dec 11 14:43:01 UTC 2025
On Mon, 8 Dec 2025 13:47:48 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> 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.
Sounds good, thanks!
>> 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`.
Okay, thanks for the clarifications.
>> src/hotspot/share/opto/memnode.cpp line 1355:
>>
>>> 1353: Node* init_value = ld_alloc->in(AllocateNode::InitValue);
>>> 1354: if (init_value != nullptr) {
>>> 1355: // TODO 8350865 Scalar replacement does not work well for flat arrays.
>>
>> Can you re-enable the tests in `TestArrays.java` marked with `// TODO 8350865 Scalar replacement does not work well for flat arrays` now? There are a few more places in the code marked with `// TODO 8350865 Scalar replacement ...` as well. We might just want to leave this to [JDK-8350865](https://bugs.openjdk.org/browse/JDK-8350865) though.
>
> Simply re-enabling the tests results in failures of scenario 2 due to the returned oop being kept alive. I will need to look into this a little further.
Sounds good, thanks!
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1755#discussion_r2610813615
PR Review Comment: https://git.openjdk.org/valhalla/pull/1755#discussion_r2610822568
PR Review Comment: https://git.openjdk.org/valhalla/pull/1755#discussion_r2610833029
More information about the valhalla-dev
mailing list