Package org.more.asm

Examples of org.more.asm.Label


        //          if (localThrowable instanceof RuntimeException)
        //              throw ((RuntimeException) localThrowable);
        //          throw new RuntimeException(localThrowable);
        //      }
        //  }
        Label tryBegin = new Label();
        Label tryEnd = new Label();
        Label tryCatch = new Label();
        mv.visitTryCatchBlock(tryBegin, tryEnd, tryCatch, "java/lang/Throwable");
        {//try {
            mv.visitLabel(tryBegin);
            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, 1);
            mv.visitTypeInsn(NEW, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class));
            mv.visitInsn(DUP);
            mv.visitLdcInsn(this.classConfig.getClassName());
            mv.visitLdcInsn(propertyName);
            mv.visitVarInsn(ALOAD, 1);
            mv.visitMethodInsn(INVOKESPECIAL, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class), "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V");
            mv.visitMethodInsn(INVOKEVIRTUAL, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class), "get", "()Ljava/lang/Object;");
            mv.visitVarInsn(ASTORE, 2);
            mv.visitVarInsn(ALOAD, 2);
            mv.visitLabel(tryEnd);
            this.codeBuilder_1(mv, propertyAsmType);
        }
        {//} 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);
View Full Code Here


        //              throw ((RuntimeException) localThrowable);
        //          throw new RuntimeException(localThrowable);
        //      }
        //  }
        //
        Label tryBegin = new Label();
        Label tryEnd = new Label();
        Label tryCatch = new Label();
        mv.visitTryCatchBlock(tryBegin, tryEnd, tryCatch, "java/lang/Throwable");
        {//try {
            mv.visitLabel(tryBegin);
            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, 2);
            mv.visitTypeInsn(NEW, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class));
            mv.visitInsn(DUP);
            mv.visitLdcInsn(this.classConfig.getClassName());
            mv.visitLdcInsn(propertyName);
            mv.visitVarInsn(ALOAD, 2);
            mv.visitMethodInsn(INVOKESPECIAL, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class), "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V");
            mv.visitVarInsn(ASMEngineToos.getLoad(propertyAsmType), 1);
            this.codeBuilder_2(mv, propertyAsmType);
            mv.visitMethodInsn(INVOKEVIRTUAL, ASMEngineToos.replaceClassName(InnerChainPropertyDelegate.class), "set", "(Ljava/lang/Object;)V");
            mv.visitLabel(tryEnd);
            mv.visitInsn(RETURN);
        }
        {//} 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);
View Full Code Here

        String asmReturns = m.group(2);
        int paramCount = asmParams.length;
        int maxStack = 5;//方法最大堆栈大小
        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);
            this.codeBuilder_2(mv, asmParams);//Class<?>[] pTypes = new Class[] { int.class, Object.class, boolean.class, short.class };
            mv.visitVarInsn(ASTORE, paramCount + 1);
            this.codeBuilder_1(mv, asmParams);//Object[] pObjects = new Object[] { abc, abcc, abcc };
            mv.visitVarInsn(ASTORE, paramCount + 2);
            //
            mv.visitVarInsn(ALOAD, 0);
            mv.visitMethodInsn(INVOKEVIRTUAL, this.thisClassName, "getClass", "()Ljava/lang/Class;");
            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);
            //
            mv.visitTypeInsn(NEW, ASMEngineToos.replaceClassName(InnerChainAopInvocation.class));
            mv.visitInsn(DUP);
            mv.visitVarInsn(ALOAD, paramCount + 3);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, paramCount + 2);
            mv.visitMethodInsn(INVOKESPECIAL, ASMEngineToos.replaceClassName(InnerChainAopInvocation.class), "<init>", "(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)V");
            mv.visitVarInsn(ASTORE, paramCount + 4);
            //
            mv.visitTypeInsn(NEW, ASMEngineToos.replaceClassName(InnerAopInvocation.class));
            mv.visitInsn(DUP);
            mv.visitLdcInsn(name + desc);
            mv.visitVarInsn(ALOAD, paramCount + 3);
            mv.visitVarInsn(ALOAD, paramCount + 4);
            mv.visitMethodInsn(INVOKESPECIAL, ASMEngineToos.replaceClassName(InnerAopInvocation.class), "<init>", "(Ljava/lang/String;Ljava/lang/reflect/Method;" + ASMEngineToos.toAsmType(AopInvocation.class) + ")V");//
            mv.visitMethodInsn(INVOKEVIRTUAL, ASMEngineToos.replaceClassName(InnerAopInvocation.class), "proceed", "()Ljava/lang/Object;");
            mv.visitVarInsn(ASTORE, paramCount + 5);
            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);
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of org.more.asm.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.