On Fri, 20 Feb 2026 16:42:30 GMT, Chen Liang <[email protected]> wrote:
>> 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? > > Unfortunately, `ValueObjectMethods` is package-private in `java.lang.runtime` > and must not be exported to the public. To consolidate uses of the acmp map, > we might have to move `ValueObjectMethods` elsewhere so > `jdk.internal.value.ValueClass` can access its without VOM being exported to > the public. I think it makes more sense to move this chunk of the method: int[] map = Unsafe.getUnsafe().getFieldMap(c); int nbNonRef = map[0]; return nbNonRef * 2 + 1 < map.length; to Unsafe.java as that keeps the decoding code close to the fetching code. As much as I'd like all the acmp_map decoding in one place, it doesn't make sense to move ValueObjectMethods at this point ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2143#discussion_r2834576359
