Package org.objectweb.asm

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


    {
      CodeVisitor cv = super.visitMethod(access, name, desc, exceptions, attrs);
      if (!name.equals("<init>") &&
          (access & (ACC_STATIC + ACC_NATIVE + ACC_ABSTRACT)) == 0)
      {
        cv.visitVarInsn(ALOAD, 0);
        cv.visitVarInsn(ALOAD, 0);
        cv.visitFieldInsn(GETFIELD, owner, "_counter", "I");
        cv.visitInsn(ICONST_1);
        cv.visitInsn(IADD);
        cv.visitFieldInsn(PUTFIELD, owner, "_counter", "I");
View Full Code Here


      CodeVisitor cv = super.visitMethod(access, name, desc, exceptions, attrs);
      if (!name.equals("<init>") &&
          (access & (ACC_STATIC + ACC_NATIVE + ACC_ABSTRACT)) == 0)
      {
        cv.visitVarInsn(ALOAD, 0);
        cv.visitVarInsn(ALOAD, 0);
        cv.visitFieldInsn(GETFIELD, owner, "_counter", "I");
        cv.visitInsn(ICONST_1);
        cv.visitInsn(IADD);
        cv.visitFieldInsn(PUTFIELD, owner, "_counter", "I");
        return new CounterCodeAdapter(cv);
View Full Code Here

      gv.visitFieldInsn(GETSTATIC,
        "java/lang/System", "err", "Ljava/io/PrintStream;");
      gv.visitLdcInsn("_get" + name + " called");
      gv.visitMethodInsn(INVOKEVIRTUAL,
        "java/io/PrintStream", "println", "(Ljava/lang/String;)V");
      gv.visitVarInsn(ALOAD, 0);
      gv.visitFieldInsn(GETFIELD, owner, name, desc);
      gv.visitInsn(t.getOpcode(IRETURN));
      gv.visitMaxs(1 + size, 1);

      // generates setter method
View Full Code Here

      sv.visitFieldInsn(GETSTATIC,
        "java/lang/System", "err", "Ljava/io/PrintStream;");
      sv.visitLdcInsn("_set" + name + " called");
      sv.visitMethodInsn(INVOKEVIRTUAL,
        "java/io/PrintStream", "println", "(Ljava/lang/String;)V");
      sv.visitVarInsn(ALOAD, 0);
      sv.visitIntInsn(t.getOpcode(ILOAD), 1);
      sv.visitFieldInsn(PUTFIELD, owner, name, desc);
      sv.visitInsn(RETURN);
      sv.visitMaxs(1 + size, 1 + size);
    }
View Full Code Here

    ClassWriter cw = new ClassWriter(true);
    cw.visit(V1_1, ACC_PUBLIC, name, "java/lang/Object", itfs, null);

    // default public constructor
    CodeVisitor mw = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mw.visitVarInsn(ALOAD, 0);
    mw.visitMethodInsn(
      INVOKESPECIAL,
      "java/lang/Object", "<init>", "()V");
    mw.visitInsn(RETURN);
    mw.visitMaxs(1, 1);
View Full Code Here

    }
   
    protected void generateNoArgConstructor(HomeContext gc) {
        CodeVisitor mv = gc.cv.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, gc.superClassJCN, "<init>", "()V");
       
      String listenclass = (String) gc.ctx.get("listenClass");
      if (listenclass != null) {
          //this.eventListener = new MyListener()
View Full Code Here

        mv.visitMethodInsn(INVOKESPECIAL, gc.superClassJCN, "<init>", "()V");
       
      String listenclass = (String) gc.ctx.get("listenClass");
      if (listenclass != null) {
          //this.eventListener = new MyListener()
            mv.visitVarInsn(ALOAD, 0);
            mv.visitTypeInsn(NEW, getJVMClassName(listenclass));
            mv.visitInsn(DUP);
            mv.visitMethodInsn(INVOKESPECIAL, getJVMClassName(listenclass),
                "<init>", "()V");
            mv.visitFieldInsn(PUTFIELD, gc.xHomeJCN, LISTENER_FIELD,
View Full Code Here

    new String[0], //interfaces
    str // sourcefile
    );
    //implement an empty public constructor
    CodeVisitor c = cw.visitMethod(Constants.ACC_PUBLIC, "<init>", "()V", null, null);
    c.visitVarInsn(Constants.ALOAD, 0);
    c.visitMethodInsn(
      Constants.INVOKESPECIAL,
      "org/objectweb/speedo/mapper/lib/Object2StringSerializer",
      "<init>",
      "()V");
View Full Code Here

        keys[i] = cbid;
        keyLabels[i] = new Label();
        i++;
      }
        Label switchEndLabel = new Label();
        mv.visitVarInsn(ILOAD, 1);
        mv.visitLookupSwitchInsn(switchEndLabel, keys, keyLabels);
       
      String listenclass = null;
      // switch (evt.type) {
      for (int j = 0; j < nbCase; j++) {
View Full Code Here

          continue;
        }
        for (SpeedoCallback actualcbn : cbl) {
          if (actualcbn.listenerClassName == null) { // this a callback from the persistent class
            // CALL THE CALLBACK METHOD INTO THE PERSISTENT CLASS
               mv.visitVarInsn(ALOAD, 2);
               mv.visitTypeInsn(CHECKCAST, gc.xJCN);
               mv.visitMethodInsn(INVOKEVIRTUAL, gc.xJCN,
                   actualcbn.callbackName,
                   actualcbn.methodByteCodeSignature);
          } else { // this is a callback from the listener class
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.