Package org.objectweb.asm

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


      CodeVisitor gv =
        cv.visitMethod(ACC_PRIVATE, "_get" + name, gDesc, null, null);
      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);
View Full Code Here


      CodeVisitor sv =
        cv.visitMethod(ACC_PRIVATE, "_set" + name, sDesc, null, null);
      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);
View Full Code Here

    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

                mv.visitVarInsn(ALOAD, 0);
                mv.visitFieldInsn(GETFIELD, gc.xHomeJCN, LISTENER_FIELD,
                     getJVMType(actualcbn.listenerClassName));
                mv.visitVarInsn(ALOAD, 2);
                mv.visitTypeInsn(CHECKCAST, gc.xJCN);
                mv.visitMethodInsn(INVOKEVIRTUAL,
                    getJVMClassName(actualcbn.listenerClassName),
                    actualcbn.callbackName,
                    actualcbn.methodByteCodeSignature);
          }
        }
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()
            mv.visitVarInsn(ALOAD, 0);
View Full Code Here

      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));
      }         
        mv.visitInsn(RETURN);
View Full Code Here

    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");
    c.visitInsn(Constants.RETURN);
View Full Code Here

    //implement the getSerializedObject method
    c = cw.visitMethod(Constants.ACC_PUBLIC, "getSerializedObject", "()Ljava/lang/String;", null, null);
    c.visitTypeInsn(Constants.NEW, "java/lang/StringBuffer");
    c.visitInsn(Constants.DUP);
    c.visitMethodInsn(Constants.INVOKESPECIAL, "java/lang/StringBuffer", "<init>", "()V");
    final int SPLIT_SIZE = 5000;
    int nbSplit = value.length() / SPLIT_SIZE;
    for (int i = 0; i < nbSplit; i++) {
      int j = i * SPLIT_SIZE;
      String s = value.substring(j, j + SPLIT_SIZE);
View Full Code Here

    int nbSplit = value.length() / SPLIT_SIZE;
    for (int i = 0; i < nbSplit; i++) {
      int j = i * SPLIT_SIZE;
      String s = value.substring(j, j + SPLIT_SIZE);
      c.visitLdcInsn(s);
      c.visitMethodInsn(
        Constants.INVOKEVIRTUAL,
        "java/lang/StringBuffer",
        "append",
        "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
    }
View Full Code Here

        "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
    }
    int last = value.length() % SPLIT_SIZE;
    if (last > 0) {
      c.visitLdcInsn(value.substring(SPLIT_SIZE * nbSplit));
      c.visitMethodInsn(
        Constants.INVOKEVIRTUAL,
        "java/lang/StringBuffer",
        "append",
        "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
    }
 
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.