[lworld] RFR: 8275195: [lworld] Revisit use of TypePtr::meet_aryptr() after merge

Tobias Hartmann thartmann at openjdk.java.net
Thu Oct 14 06:25:15 UTC 2021


On Wed, 13 Oct 2021 13:49:17 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> Do you want me to take care of it in this change?

Yes, that would be great.

> is that not correct?

I'm a bit confused by this logic:
https://github.com/openjdk/valhalla/blob/cb080234f25f77f24c67d5f62b89a7b0908bf097/src/hotspot/share/opto/type.cpp#L5954-L5964

 `not_flat` is supposed to be true iff we know that the array can never be flat. However, it's initialized with `!k->is_flat_array_klass()` which does **not** mean that the array can never be flat. It could be an object array which can be flat if the element type is not exact. Also not null-free should imply not flat. In general, we can deduce that an array is not flat if (1) `!UseFlatArray`, (2) the array is not null-free or (3) the element type is an inline type that is not flattened in arrays.

Or am I missing something?

I think this logic should be orthogonal to this:
https://github.com/openjdk/valhalla/blob/cb080234f25f77f24c67d5f62b89a7b0908bf097/src/hotspot/share/opto/type.cpp#L3607-L3611

Also, can we use an enum for `TypeAryKlassPtr::_null_free`? The tri-state via an int is confusing as well.

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

PR: https://git.openjdk.java.net/valhalla/pull/560



More information about the valhalla-dev mailing list