On Fri, 8 May 2026 03:30:54 GMT, Shiv Shah <[email protected]> wrote:
> Added OopMapsValue and OopMapsSameGroupValue, mirrors OopMaps tests using
> Integer instances to test contended oop maps with value class objects.
>
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
As they are currently written, these tests don't exercise interactions between
contended or oopmap code and value types. The classes with `@Contended`
annotations are using `j.l.Object` typed fields, which the VM handles as
regular reference fields, not values, for both layout decisions and oopmap
generation.
To test interactions between `@Contended` and value fields, I'd recommend
declaring a small value types, less than 56 bits, so it can be flattened (the
declared value class Point with two int fields is too big to be flattened), and
then declare contended fields using the *exact* type of the field, not a super
type.
To test contended/value types/oopmap interactions, I'd recommend to declare a
value type containing a reference type and a small primitive type (for instance
`value record Opt(Object o, boolean b) { }` ), and then declare contended
fields of this *exact* type. This kind of value type would be flattened in VMs
using compressed oops, and not flattened in VMs using full size oops, creating
two distinct patterns of field layouts including oops and contended padding.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/2413#issuecomment-4432993371