On Mon, 20 May 2024 16:42:19 GMT, Paul Sandoz <psan...@openjdk.org> wrote:

> 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);
>         }
> ```

True, the chain for segment var handle is quite long (and that is not a result 
of this patch, it has always been more or less like that). Funnily, I was 
staring at this piece of code the other day, and I think this can be dealt with 
morally with a `foldArguments`, but we don't have the equivalent of that in the 
VH/coordinates world. Maybe we should add that (or at least implement 
internally) as that would simplify the adaptation, avoiding the permute step 
(which is typically rather heavy).

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

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

Reply via email to