Package org.objectweb.asm

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


                            "Generate the method: getCeIdentifier");
        }
        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


        if (debug) {
            logger.log(BasicLevel.DEBUG, "Generate the method: fixCe");
        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "fixCe", "()V", null, null);
        // speedoFixCount++;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitFieldInsn(GETFIELD, classToWrite, FIX_FIELD_NAME, "I");
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IADD);
        mv.visitFieldInsn(PUTFIELD, classToWrite, FIX_FIELD_NAME, "I");
View Full Code Here

            logger.log(BasicLevel.DEBUG, "Generate the method: unfixCe");
        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "unfixCe", "()V", null,
                null);
        // speedoFixCount--;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);
        mv.visitFieldInsn(GETFIELD, classToWrite, FIX_FIELD_NAME, "I");
        mv.visitInsn(ICONST_1);
        mv.visitInsn(ISUB);
        mv.visitFieldInsn(PUTFIELD, classToWrite, FIX_FIELD_NAME, "I");
View Full Code Here

            logger.log(BasicLevel.DEBUG, "Generate the method: getCeFixCount");
        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "getCeFixCount", "()I",
                null, null);
        // return speedoFixCount;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, classToWrite, FIX_FIELD_NAME, "I");
        mv.visitInsn(IRETURN);
        mv.visitMaxs(0, 0);
    }
View Full Code Here

            logger.log(BasicLevel.DEBUG, "Generate the method: getCeAge");
        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "getCeAge", "()J", null,
                null);
        // return speedoAge;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, classToWrite, AGE_FIELD_NAME, "J");
        mv.visitInsn(LRETURN);
        mv.visitMaxs(0, 0);
    }
View Full Code Here

            logger.log(BasicLevel.DEBUG, "Generate the method: setCeAge");
        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "setCeAge", "(J)V", null,
                null);
        // this.speedoAge = a;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(LLOAD, 1);
        mv.visitFieldInsn(PUTFIELD, classToWrite, AGE_FIELD_NAME, "J");
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
    }
View Full Code Here

        }
        CodeVisitor mv = cv.visitMethod(ACC_PUBLIC, "setCeAge", "(J)V", null,
                null);
        // this.speedoAge = a;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(LLOAD, 1);
        mv.visitFieldInsn(PUTFIELD, classToWrite, AGE_FIELD_NAME, "J");
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
    }
}
View Full Code Here

    cv.visit(version, access, name, superName, interfaces, sourceFile);
    //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 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;
        while(current != null) {
View Full Code Here

              SpeedoField sp = (SpeedoField) it.next();
              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);
              }
          }
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.