[lworld] RFR: 8370450: [lworld] Alternate implementation of the substitutability test method [v2]

Chen Liang liach at openjdk.org
Wed Oct 22 21:55:16 UTC 2025


On Wed, 22 Oct 2025 18:17:30 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> This is an alternate version of the substitutability method.
>> To use it, add -Xshare:off -XX:+UseAltSubstitutabilityMethod to the command line of the Valhalla VM in preview mode.
>
> Frederic Parain has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - Merge remote-tracking branch 'upstream/lworld' into new_acmp
>  - Add alternate version of the substitutability method

src/hotspot/share/classfile/classFileParser.cpp line 1584:

> 1582:     FieldInfo::FieldFlags fflags2(0);
> 1583:     fflags2.update_injected(true);
> 1584:     fflags2.update_stable(true);

If c2 can model the field map read as a stable array read, this allows ValueObjectMethods to generate efficient code for specialized value types in the future. 👍

src/hotspot/share/classfile/fieldLayoutBuilder.hpp line 289:

> 287:   FieldLayout* _layout;
> 288:   FieldLayout* _static_layout;
> 289:   GrowableArray<Pair<int,int>>* _nonoop_acmp_map ;

Suggestion:

  GrowableArray<Pair<int,int>>* _nonoop_acmp_map;

src/hotspot/share/oops/instanceKlass.hpp line 650:

> 648:   ReferenceType reference_type() const     { return (ReferenceType)_reference_type; }
> 649: 
> 650:   int acmp_maps_offset() const { return _acmp_maps_offset; }

Probably assert `_acmp_maps_offset != 0`

src/hotspot/share/runtime/globals.hpp line 2053:

> 2051:           "binary search over simple linear search." )                      \
> 2052:                                                                             \
> 2053:   product(bool, UseAltSubstitutabilityMethod, false,                        \

We might need this flag on/off for core-libs tests in addition to runtime tests.

src/java.base/share/classes/java/lang/runtime/ValueObjectMethods.java line 1417:

> 1415:         int size = map[i * 2 + 2];
> 1416:         int nlong = size / 8;
> 1417:         for (int j = 0; j < nlong; j++) {

Are we sure that for all value objects with `size >= 8`, they are always 8-byte aligned?

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1695#discussion_r2453314756
PR Review Comment: https://git.openjdk.org/valhalla/pull/1695#discussion_r2453373333
PR Review Comment: https://git.openjdk.org/valhalla/pull/1695#discussion_r2453329386
PR Review Comment: https://git.openjdk.org/valhalla/pull/1695#discussion_r2453432714
PR Review Comment: https://git.openjdk.org/valhalla/pull/1695#discussion_r2453430849


More information about the valhalla-dev mailing list