ArrayProperties are user requirements and shouldn't be changed by the JVM. However, there is an issue with this:
If the value class does not have a null-free non-atomic layout but has a null-free atomic layout (for example, it is not @LooselyConsistentValue), then it is reasonable that calling ValueClass::newNullRestrictedNonAtomicArray will return a null-restricted atomic array instead of a non-flat array. The array properties need to be correct, it needs to correctly report that it is an atomic array, so that accesses do not violate its non-@LooselyConsistentValue.
This is currently an issue with our internal API, the public API only allows creation of nullable arrays, and they are always atomic.
Some possible approaches:
- Just have incorrect array properties, we can still consult the layout kind for the correct atomicity.
- Disallow ValueClass::newNullRestrictedNonAtomicArray if we cannot create a flat array out of it.
If the value class does not have a null-free non-atomic layout but has a null-free atomic layout (for example, it is not @LooselyConsistentValue), then it is reasonable that calling ValueClass::newNullRestrictedNonAtomicArray will return a null-restricted atomic array instead of a non-flat array. The array properties need to be correct, it needs to correctly report that it is an atomic array, so that accesses do not violate its non-@LooselyConsistentValue.
This is currently an issue with our internal API, the public API only allows creation of nullable arrays, and they are always atomic.
Some possible approaches:
- Just have incorrect array properties, we can still consult the layout kind for the correct atomicity.
- Disallow ValueClass::newNullRestrictedNonAtomicArray if we cannot create a flat array out of it.
- relates to
-
JDK-8372113 [lworld] Fix various issues with TypeAryPtr and TypeAryKlassPtr
-
- Resolved
-