On Mon, 20 May 2024 16:31:18 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

> 
> Ah, got it. You mean more support in VarHandleGuards. Yes, I have a separate 
> patch for that (actually had that for quite a while), but we're not super 
> sure how to evaluate what impact it has :-)

Ah, i did not realize that. Yes its tricky, it was designed for VHs to 
fields/arrays, to really minimize their overhead. With segments there is 
already some additional overhead e.g.,

        if (derefAdapters.length == 0) {
            // insert align check for the root layout on the initial MS + offset
            List<Class<?>> coordinateTypes = handle.coordinateTypes();
            MethodHandle alignCheck = 
MethodHandles.insertArguments(MH_CHECK_ENCL_LAYOUT, 2, rootLayout());
            handle = MethodHandles.collectCoordinates(handle, 0, alignCheck);
            int[] reorder = IntStream.concat(IntStream.of(0, 1), 
IntStream.range(0, coordinateTypes.size())).toArray();
            handle = MethodHandles.permuteCoordinates(handle, coordinateTypes, 
reorder);
        }

So perhaps it does not make much difference.

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

PR Comment: https://git.openjdk.org/jdk/pull/19251#issuecomment-2120813942

Reply via email to