Package org.objectweb.asm

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


          (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);
      }
      return cv;
View Full Code Here


      {
        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);
      }
      return cv;
    }
View Full Code Here

      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
      String sDesc = "(" + desc + ")V";
      CodeVisitor sv =
View Full Code Here

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

  public CodeVisitor visitMethod (
View Full Code Here

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

    // eval method
    mw = cw.visitMethod(ACC_PUBLIC, "eval", "(II)I", null, null);
    compile(mw);
View Full Code Here

    mw.visitMaxs(1, 1);

    // eval method
    mw = cw.visitMethod(ACC_PUBLIC, "eval", "(II)I", null, null);
    compile(mw);
    mw.visitInsn(IRETURN);
    // max stack and max locals automatically computed
    mw.visitMaxs(0, 0);

    return cw.toByteArray();
  }
View Full Code Here

        // break;
          mv.visitJumpInsn(GOTO, switchEndLabel);
      }
      mv.visitLabel(switchEndLabel);
      // }
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
     
      if (listenclass != null) {
        // ADD THE DEFINITION OF THE LISTENER CLASS VARIABLE
            gc.cv.visitField(ACC_PUBLIC + ACC_FINAL,
View Full Code Here

       
        //public boolean hasInstanceLifeCycleListeners() {
        mv = gc.cv.visitMethod(ACC_PUBLIC, "hasInstanceLifeCycleListeners",
                "()Z", null, null);
        //return true;
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IRETURN);
        mv.visitMaxs(0, 0);
        //}
       
View Full Code Here

        //public boolean hasInstanceLifeCycleListeners() {
        mv = gc.cv.visitMethod(ACC_PUBLIC, "hasInstanceLifeCycleListeners",
                "()Z", null, null);
        //return true;
        mv.visitInsn(ICONST_1);
        mv.visitInsn(IRETURN);
        mv.visitMaxs(0, 0);
        //}
       

    }
View Full Code Here

      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,
              getJVMType(listenclass));
      }         
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.