[lworld] RFR: 8378273: [lworld] Use acmp map to detect oops for VarHandle [v2]

Roger Riggs rriggs at openjdk.org
Fri Feb 20 20:01:12 UTC 2026


On Fri, 20 Feb 2026 18:33:21 GMT, Dan Heidinga <heidinga at openjdk.org> wrote:

>> 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

I'd put the entire function returning a boolean "hasOops(Class c)" in Unsafe. Exposing only a very specific function without exposing the implementation. (As DanH suggests).

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/2143#discussion_r2834884222


More information about the valhalla-dev mailing list