Package org.objectweb.asm

Examples of org.objectweb.asm.CodeVisitor.visitMethodInsn()


          c.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
          c.visitInsn(DUP);
          c.visitVarInsn(ALOAD, 1);
          c.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ClassNotFoundException",
            "getMessage", "()Ljava/lang/String;");
          c.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError",
            "<init>", "(Ljava/lang/String;)V");
          c.visitInsn(ATHROW);
          c.visitTryCatchBlock(l0, l1, l2, "java/lang/ClassNotFoundException");
          c.visitMaxs(0, 0);
        }
View Full Code Here


        if (methodNames.size() > 0) {
            CodeVisitor mv = this.cv.visitMethod(Constants.ACC_STATIC,
                    "<clinit>", "()V", null, null);
            for (int i = 0; i < methodNames.size(); i++) {
                String methodName = (String) methodNames.get(i);
                mv.visitMethodInsn(Constants.INVOKESTATIC, classToWrite,
                        methodName, "()V");
            }
            mv.visitInsn(Constants.RETURN);
        }
        super.visitEnd();
View Full Code Here

        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "getCeIdentifier",
                "()Ljava/lang/Object;", null, null);
        // return getPName();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite, "getPName",
                "()Lorg/objectweb/jorm/naming/api/PName;");
        mv.visitInsn(ARETURN);
        mv.visitMaxs(0, 0);
    }
View Full Code Here

    //Generate a no-arg constructor if required
    if (status == SpeedoClass.NO_NO_ARG_CONSTRUCTOR) {
      CodeVisitor _cv = this.cv.visitMethod(
        Constants.ACC_PUBLIC, "<init>", "()V", null, null);
      _cv.visitVarInsn(Constants.ALOAD, 0);
      _cv.visitMethodInsn(Constants.INVOKESPECIAL, superName, "<init>", "()V");
      _cv.visitInsn(Constants.RETURN);
      _cv.visitMaxs(1, 1);
    }
  }
View Full Code Here

        // GENERATE: Titi t = new Titi();
        // GENERATE: Titi is the class of the user identifier
        logger.log(BasicLevel.DEBUG, "add code: " + uicn + " t = new " + uicn + "();");
        _cv.visitTypeInsn(Constants.NEW, uicn);
        _cv.visitInsn(Constants.DUP);
        _cv.visitMethodInsn(Constants.INVOKESPECIAL, uicn, "<init>", "()V");
        _cv.visitVarInsn(Constants.ASTORE, 1);

        //t.f1 = this.f1
        boolean hasLongOrDouble = false;
        SpeedoClass current = speedoClass;
View Full Code Here

        // GENERATE: t.speedoSetPersistentClassName(this.getPType().getJormName());
        logger.log(BasicLevel.DEBUG, "add code: t.speedoSetPersistentClassName(this.getPType().getJormName());");
        _cv.visitVarInsn(Constants.ALOAD, 1);
        _cv.visitVarInsn(Constants.ALOAD, 0);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                className, "getPType", "()" + PTYPE_DESC);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                PTYPE_CLASS_NAME, "getJormName", "()Ljava/lang/String;");
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                uicn, "speedoSetPersistentClassName", "(Ljava/lang/String;)V");
View Full Code Here

        logger.log(BasicLevel.DEBUG, "add code: t.speedoSetPersistentClassName(this.getPType().getJormName());");
        _cv.visitVarInsn(Constants.ALOAD, 1);
        _cv.visitVarInsn(Constants.ALOAD, 0);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                className, "getPType", "()" + PTYPE_DESC);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                PTYPE_CLASS_NAME, "getJormName", "()Ljava/lang/String;");
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                uicn, "speedoSetPersistentClassName", "(Ljava/lang/String;)V");
        logger.log(BasicLevel.DEBUG, "add code: return t;");
        _cv.visitVarInsn(Constants.ALOAD, 1);
View Full Code Here

        _cv.visitVarInsn(Constants.ALOAD, 0);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                className, "getPType", "()" + PTYPE_DESC);
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                PTYPE_CLASS_NAME, "getJormName", "()Ljava/lang/String;");
        _cv.visitMethodInsn(Constants.INVOKEVIRTUAL,
                uicn, "speedoSetPersistentClassName", "(Ljava/lang/String;)V");
        logger.log(BasicLevel.DEBUG, "add code: return t;");
        _cv.visitVarInsn(Constants.ALOAD, 1);
        _cv.visitInsn(Constants.ARETURN);
        _cv.visitMaxs((hasLongOrDouble ? 3 : 2), 2);
View Full Code Here

        mv = cv.visitMethod(ACC_PUBLIC + ACC_FINAL + ACC_STATIC,
                f.getGetter(),
                "(" + getJVMType(classToWrite) + ")" + ft.getDescriptor(), null, null);
        //return instance.${f.getter}();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite,
                f.getGetter(), "()" +  ft.getDescriptor());
        mv.visitInsn(ft.getOpcode(IRETURN));
        mv.visitMaxs(0, 0);
    }
    private void generateStaticFieldSetter(Field f, Type ft) {
View Full Code Here

        mv = cv.visitMethod(ACC_PUBLIC + ACC_FINAL + ACC_STATIC, f.getSetter(),
                "(" + getJVMType(classToWrite) + ft.getDescriptor() + ")V", null, null);
        //instance.${f.setter}(val);
        mv.visitVarInsn(ALOAD, 0); //Class instance
        mv.visitVarInsn(ft.getOpcode(ILOAD), 1); //field
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite, f.getSetter(),
                "(" + ft.getDescriptor() + ")V");
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
    }
    private void generateFieldGetter(Field f, Type ft, String ftd, int nbField) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.