Package org.objectweb.asm

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


        mv.visitFieldInsn(GETFIELD, classToWrite, FIX_FIELD_NAME, "I");
        mv.visitInsn(ICONST_1);
        mv.visitInsn(ISUB);
        mv.visitFieldInsn(PUTFIELD, classToWrite, FIX_FIELD_NAME, "I");

        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
    }

    /**
     * Generates the method getCeFixCount():int
View Full Code Here


        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);
    }

    /**
     * Generates the method getCeAge():long
View Full Code Here

        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);
    }

    /**
     * Generates the method setCeAge(long):void
View Full Code Here

                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

    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);
    }
  }

  public CodeVisitor visitMethod(final int access,
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;
View Full Code Here

                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

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

                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);

        //Add the method speedoSetPersistentClassName
        methodName = "speedoSetPersistentClassName";
        logger.log(BasicLevel.DEBUG, "Add to the class " + className
View Full Code Here

                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);
    }

    public CodeVisitor visitMethod(final int access,
                                   final String name,
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.