String asmReturns = m.group(2);
int paramCount = asmParams.length;
int maxStack = 4;//方法最大堆栈大小
int maxLocals = paramCount + 5;//本地变量表大小
//
Label tryBegin = new Label();
Label tryEnd = new Label();
Label tryCatch = new Label();
mv.visitTryCatchBlock(tryBegin, tryEnd, tryCatch, "java/lang/Throwable");
{//try {
mv.visitLabel(tryBegin);
//Class<?>[] pTypes = new Class[] { int.class, Object.class, boolean.class, short.class };
this.codeBuilder_2(mv, asmParams);
mv.visitVarInsn(ASTORE, paramCount + 1);
//Object[] pObjects = new Object[] { abc, abcc, abcc };
this.codeBuilder_1(mv, asmParams);
mv.visitVarInsn(ASTORE, paramCount + 2);
//
//List.class.getMethod("getNames", arrayOfClass);
mv.visitLdcInsn(Type.getType(ASMEngineToos.toAsmType(faceType)));
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, paramCount + 1);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getMethod", "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;");
mv.visitVarInsn(ASTORE, paramCount + 3);
//
//ClassLoader localLoader = getClass().getClassLoader();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getClassLoader", "()Ljava/lang/ClassLoader;");
mv.visitVarInsn(ASTORE, paramCount + 4);
//
//Object target = new InnerChainMethodDelegate("xxxx", localLoader).invoke(localMethod, this, arrayOfObject);
mv.visitTypeInsn(NEW, ASMEngineToos.replaceClassName(InnerChainMethodDelegate.class));
mv.visitInsn(DUP);
mv.visitLdcInsn(this.classConfig.getClassName());
mv.visitLdcInsn(faceType.getName());
mv.visitVarInsn(ALOAD, paramCount + 4);
mv.visitMethodInsn(INVOKESPECIAL, ASMEngineToos.replaceClassName(InnerChainMethodDelegate.class), "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V");
mv.visitVarInsn(ALOAD, paramCount + 3);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, paramCount + 2);
mv.visitMethodInsn(INVOKEVIRTUAL, ASMEngineToos.replaceClassName(InnerChainMethodDelegate.class), "invoke", "(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
mv.visitVarInsn(ASTORE, paramCount + 5);
//
//return
mv.visitVarInsn(ALOAD, paramCount + 5);
mv.visitLabel(tryEnd);
this.codeBuilder_3(mv, asmReturns);
}
{//} catch (Exception e) {
mv.visitLabel(tryCatch);
mv.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[] { "java/lang/Throwable" });
mv.visitVarInsn(ASTORE, 5);
mv.visitVarInsn(ALOAD, 5);
mv.visitTypeInsn(INSTANCEOF, "java/lang/RuntimeException");
Label ifBlock = new Label();
mv.visitJumpInsn(IFEQ, ifBlock);
mv.visitVarInsn(ALOAD, 5);
mv.visitTypeInsn(CHECKCAST, "java/lang/RuntimeException");
mv.visitInsn(ATHROW);
mv.visitLabel(ifBlock);