I'm working my way through understanding Call Sites & Method Handles for some interpreter work I'm considering, and everything looks very sensible, except for argument marshalling... I'd like to be able to have a MethodHandle combinator that takes a sequence of MethodHandles and, for each one, an array of indices into an Object, such that the MethodHandle objects are executed sequentially, with the values indicated passed in as each MethodHandle's argument list --> the end result of the combinator being a MethodHandle accepting the Object as an input and returning it as an output.
I could write a method that did something analogous, calling each MethodHandle in sequence, but I'd like to have the end result being the generation of aload or aaload instructions to marshal arguments, not the (much more expensive) creation, population & spreading of new Object instances per MethodHandle call.
Can y'all recommend an approach that'll lead to optimal performance vis-a-vis the design philosophy behind the invoke package? I'm still a newbie here and am probably missing something, but so far I'm missing it....