{
// allocate a slot for the invoke parameters array,
// construct the array
// stash it into the slot and return the slot idx
Type objectType = Type.getType(Object.class);
Type objectArrayType = Type.getType("[Ljava/lang/Object;");
Type[] invokeParamTypes = getInvokedTypes();
int savedValueCount = invokeParamTypes.length;
// create the array and save it in a local var slot
int arrayValueSlot = newLocal(objectArrayType);
push(savedValueCount);
newArray(objectType);
storeLocal(arrayValueSlot);
// pop the arguments off the stack into the invoke parameters array
// n.b. the top one is the last parameter
for (int i = savedValueCount - 1; i >= 0; i--) {
Type type = invokeParamTypes[i];
if (type != null) {
// convert value to object if needed
box(type);
// load array and swap under value
loadLocal(arrayValueSlot);
swap(objectArrayType, objectType);
// load index and swap under value
push(i);
swap(Type.INT_TYPE, objectType);
} else {
// this is a static method and index is 0 so we install null in the array
// load array index and then null
loadLocal(arrayValueSlot);
push(i);
push((Type)null);
}
// store the value in the array as an object
arrayStore(objectType);
}
// now restore the arguments from the array in increasing order
for (int i = 0; i < savedValueCount; i++) {
Type type = invokeParamTypes[i];
if (type != null) {
// load the array, retrieve the object and unbox if needed
loadLocal(arrayValueSlot);
push(i);
arrayLoad(objectType);