On Thu, 23 Apr 2026 19:34:48 GMT, Frederic Parain <[email protected]> wrote:
> Fixes in the logic to determine if a value class is naturally atomic or not. > The previous implementation incorrectly considered values classes with a > single non-empty nullable field as being naturally atomic. > Also includes improvements to the InstanceKlass::is_naturally_atomic() to > prevent bad usages. > > Tested locally. > More testing in progress on Mach5 (tiers 1-4). > > > > --------- > - [X] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 82: > 80: assert(field_info.access_flags().is_strict(), "null-free fields must > be strict"); > 81: if (vk->must_be_atomic() || AlwaysAtomicAccesses) { > 82: if (vk->is_naturally_atomic(true) && > vk->has_null_free_non_atomic_layout()) return > LayoutKind::NULL_FREE_NON_ATOMIC_FLAT; It's a bit hard to know what the true here means from first glance. Maybe we can add comments to the plain boolean calls? Suggestion: if (vk->is_naturally_atomic(true /* null_free */) && vk->has_null_free_non_atomic_layout()) return LayoutKind::NULL_FREE_NON_ATOMIC_FLAT; ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2361#discussion_r3137554502
