[lworld] RFR: 8378273: [lworld] Use acmp map to detect oops for VarHandle [v2]
Dan Heidinga
heidinga at openjdk.org
Fri Feb 20 16:02:43 UTC 2026
On Thu, 19 Feb 2026 19:33:16 GMT, Chen Liang <liach at openjdk.org> wrote:
>> VarHandle reflectively checks if a class has oops (and does it incorrectly by not filtering static fields). This information is easily accessible from acmp maps, and we should use that instead of spinning our custom logic.
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>
> interface-typed fields were using atomic flat VHs ???
We want to keep the encoding of acmp_maps - which is highly implementation dependent - in as few places as possible. Keeping it in native code or in as small a number of classes as possible is better for maintenance.
Can you move this method to ValueObjectMethods as that class must already decode the acmp_maps for `isSubstitutable`?
src/java.base/share/classes/jdk/internal/value/ValueClass.java line 66:
> 64: int[] map = Unsafe.getUnsafe().getFieldMap(c);
> 65: int nbNonRef = map[0];
> 66: return nbNonRef * 2 + 1 < map.length;
This method encodes the acmp map layout in a second place in Java. The first being in ValueObjectMethods. Rather than propagating this encoding, can we move this method to ValueObjectMethods so the encoding is kept in one place?
-------------
Changes requested by heidinga (no project role).
PR Review: https://git.openjdk.org/valhalla/pull/2143#pullrequestreview-3832810721
PR Review Comment: https://git.openjdk.org/valhalla/pull/2143#discussion_r2833898595
More information about the valhalla-dev
mailing list