Package org.objectweb.asm

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


              if (sp.primaryKey) {
                  hasLongOrDouble |= sp.type.charAt(0) == 'D'
                        || sp.type.charAt(0) == 'J';
                  logger.log(BasicLevel.DEBUG, "add code: this." + sp.name + " = t." + sp.name);
                  _cv.visitVarInsn(Constants.ALOAD, 1); //Can be a long|double value
                  _cv.visitVarInsn(Constants.ALOAD, 0);
                  _cv.visitFieldInsn(Constants.GETFIELD, className, sp.name, sp.type);
                  _cv.visitFieldInsn(Constants.PUTFIELD, uicn, sp.name, sp.type);
              }
          }
      SpeedoClass tmp = current.getSuper();
View Full Code Here


      current = (tmp == current ? null : tmp);
    }

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

        _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

                        Constants.ACC_PUBLIC,
                        methodName,
                        "(Ljava/lang/Object;)" + sp.type,
                        null,
                        null);
                _cv.visitVarInsn(Constants.ALOAD, 0);
                _cv.visitFieldInsn(Constants.GETFIELD, className, sp.name, sp.type);
                Type returnType = Type.getType(sp.type);
                _cv.visitInsn(returnType.getOpcode(Constants.IRETURN));
                _cv.visitMaxs(
                        (sp.type.equals("J") || sp.type.equals("D")) ? 2 : 1,
View Full Code Here

                Constants.ACC_PUBLIC,
                methodName,
                "()Ljava/lang/String;",
                null,
                null);
        mv.visitVarInsn(Constants.ALOAD, 0);
        mv.visitFieldInsn(Constants.GETFIELD,
                className, ADDED_FIELD_NAME, ADDED_FIELD_DESC);
        Type returnType = Type.getType(ADDED_FIELD_DESC);
        mv.visitInsn(returnType.getOpcode(Constants.IRETURN));
        mv.visitMaxs(1, 2);
View Full Code Here

                Constants.ACC_PUBLIC,
                methodName,
                "(Ljava/lang/String;)V",
                null,
                null);
        mv.visitVarInsn(Constants.ALOAD, 0);
        mv.visitVarInsn(Constants.ALOAD, 1);
        mv.visitFieldInsn(Constants.PUTFIELD,
                className, ADDED_FIELD_NAME, ADDED_FIELD_DESC);
        mv.visitInsn(Constants.RETURN);
        mv.visitMaxs(2, 2);
View Full Code Here

                methodName,
                "(Ljava/lang/String;)V",
                null,
                null);
        mv.visitVarInsn(Constants.ALOAD, 0);
        mv.visitVarInsn(Constants.ALOAD, 1);
        mv.visitFieldInsn(Constants.PUTFIELD,
                className, ADDED_FIELD_NAME, ADDED_FIELD_DESC);
        mv.visitInsn(Constants.RETURN);
        mv.visitMaxs(2, 2);
    }
View Full Code Here

                                   final String desc,
                                   final String[] exceptions,
                                   final Attribute attrs) {
        CodeVisitor c = cv.visitMethod(access, name, desc, exceptions, attrs);
        if (name.equals("<init>")) {
            c.visitVarInsn(Constants.ALOAD, 0);
            c.visitLdcInsn(speedoClass.getFQName()); //load a constant
            c.visitFieldInsn(Constants.PUTFIELD, className,
                ADDED_FIELD_NAME, ADDED_FIELD_DESC);
        }
        return c;
View Full Code Here

        CodeVisitor mv;
        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);
    }
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.