[lworld] RFR: 8372261: [lworld] Augment vmTestbase array tests with large flat arrays [v2]

Leonid Mesnik lmesnik at openjdk.org
Fri Feb 13 16:09:37 UTC 2026


On Fri, 13 Feb 2026 15:01:59 GMT, Paul Hübner <phubner at openjdk.org> wrote:

>> Leonid Mesnik has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed gp name
>
> test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java line 139:
> 
>> 137:                 return getReferenceSize();
>> 138:             }
>> 139:             return 8;
> 
> This comment applies to all `getXXXArrayElementSize` methods. The element size depends on many things, such as the properties of the array (controls flattening decisions and/or layout) and the VM (flattening can be disabled). 
> 
> For JEP 401, we only consider the nullable atomic layout. Even for this simple case, we should, in my opinion, do the following:
> - Check if flattening is enabled. For this, we can use the `WhiteBox` API to get the VM flag values. Some relevant flags may be: `UseArrayFlattening`, `UseFieldFlattening`, `UseNullableValueFlattening`, `UseAtomicValueFlattening`. 
> - File an RFE to track hardcoding the size, such that we can change it once there are more layouts available.
> 
> A more robust solution would be to use `test/hotspot/jtreg/runtime/valhalla/inlinetypes/field_layout/FieldLayoutAnalyzer.java` in order to get more comprehensive layout information.

Thanks for pointer.  It is very good example.
But as I said, we need to find single solution for Memory sizes. And more important is it worth for these tests or such "rough" estimation is enough.

> test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java line 208:
> 
>> 206:                 int length = (int) Math.min((memory - arrayExtraSize) / objectSize,
>> 207:                         Integer.MAX_VALUE);
>> 208:                 return Math.max(length, 0);
> 
> In which scenarios do you anticipate to get a negative `length`?

When we create a lot of small arrays, it finally might be got something like
getArrayLength(memory = 8 , objectSize)
so 
memory - arrayExtraSize
become negative.

> test/hotspot/jtreg/vmTestbase/nsk/share/gc/MemoryObject.java line 49:
> 
>> 47:                 }
>> 48:            } else {
>> 49:                 storage = new int[0];
> 
> This else case wasn't here before right? I'm not sure I follow why we need an empty array.

just to always have initialized not-null:
        `private final Object storage;`

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/2099#discussion_r2804924130
PR Review Comment: https://git.openjdk.org/valhalla/pull/2099#discussion_r2804918932
PR Review Comment: https://git.openjdk.org/valhalla/pull/2099#discussion_r2804922280


More information about the valhalla-dev mailing list