for (int i = 0; i < numArgs; i++) {
argTypes[i] = processType(atpos(argTypesSmo, i, tc).get_str(tc));
}
int numExtraArgs = (int) extraArgsSmo.elems(tc);
MethodType bsmMT = MethodType.methodType(CallSite.class, MethodHandles.Lookup.class,
java.lang.String.class, MethodType.class);
Object[] extraArgs = new Object[numExtraArgs];
for (int i = 0; i < numExtraArgs; i++) {
SixModelObject extra = atpos(extraArgsSmo, i, tc);
if (istype(extra, jastPushI, tc) != 0) {
extraArgs[i] = getattr_i(extra, jastPushI, "$!value", 0, tc);
bsmMT = bsmMT.appendParameterTypes(long.class);
}
else if (istype(extra, jastPushN, tc) != 0) {
extraArgs[i] = getattr_n(extra, jastPushN, "$!value", 0, tc);
bsmMT = bsmMT.appendParameterTypes(double.class);
}
else if (istype(extra, jastPushS, tc) != 0) {
extraArgs[i] = getattr_s(extra, jastPushS, "$!value", 0, tc);
bsmMT = bsmMT.appendParameterTypes(String.class);
}
else if (istype(extra, jastPushIdx, tc) != 0) {
extraArgs[i] = (int) getattr_i(extra, jastPushIdx, "$!value", 0, tc);
bsmMT = bsmMT.appendParameterTypes(int.class);
}
else {
throw new RuntimeException("Unrecognized extra argument for invokedynamic");
}
}
Handle bsmHandle = new Handle(Opcodes.H_INVOKESTATIC, bsmType, bsmName, bsmMT.toMethodDescriptorString());
m.visitInvokeDynamicInsn(name, Type.getMethodDescriptor(retType, argTypes), bsmHandle, extraArgs);
}