Package org.objectweb.asm

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


       
      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


    c.visitInsn(Constants.RETURN);
    c.visitMaxs(0, 0);

    //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++) {
View Full Code Here

        }
        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
            if (listenclass == null) {
View Full Code Here

            //this.eventListener.myMethod(param1)
                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

          c.visitLabel(l1);
          c.visitInsn(ARETURN);
                final Label l2 = new Label();
          c.visitLabel(l2);
          c.visitVarInsn(ASTORE, 1);
          c.visitTypeInsn(NEW, "java/lang/NoClassDefFoundError");
          c.visitInsn(DUP);
          c.visitVarInsn(ALOAD, 1);
          c.visitMethodInsn(INVOKEVIRTUAL, "java/lang/ClassNotFoundException",
            "getMessage", "()Ljava/lang/String;");
          c.visitMethodInsn(INVOKESPECIAL, "java/lang/NoClassDefFoundError",
View Full Code Here

                null);

        // 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
View Full Code Here

            // && !(($classNameFields) speedoReferenceState).${f.name}Loaded
            generateGetRefState(mv, true);
            mv.visitFieldInsn(GETFIELD, xfieldsJCN, f.getName() + "Loaded", "Z");
            mv.visitJumpInsn(IFNE, l1);
            {
                mv.visitTypeInsn(NEW, personality.getDetachedFieldAccessExceptionClassNameSlash());
                mv.visitInsn(DUP);
                mv.visitLdcInsn("Field " + f.getName() + " cannot be accessed: not loaded when the object has been detached");
                mv.visitMethodInsn(INVOKESPECIAL, personality.getDetachedFieldAccessExceptionClassNameSlash(), "<init>", "(Ljava/lang/String;)V");
                mv.visitInsn(ATHROW);
            }
View Full Code Here

        //StateItf sa = this.speedoReadIntention(new long[] { ... });
        mv.visitVarInsn(ALOAD, 0);
        generateFieldIdAsLongArray(f, nbField, mv);
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite, "speedoReadIntention",
                "([J)" + JT_STATE);
        mv.visitTypeInsn(CHECKCAST, xfieldsJCN);
        mv.visitVarInsn(ASTORE, 1);

        //return sa.f1;
        mv.visitVarInsn(ALOAD, 1);
        mv.visitFieldInsn(GETFIELD, xfieldsJCN, f.getName(), ftd);
View Full Code Here

                mv.visitFieldInsn(GETFIELD, xfieldsJCN, f.getName() + "Loaded", "Z");
                Label l5 = new Label();
                mv.visitJumpInsn(IFNE, l5);
                {
                    //throw new DetachedFieldAccessException("Field $f.name cannot be accessed: not loaded when the object has been detached");
                    mv.visitTypeInsn(NEW, personality.getDetachedFieldAccessExceptionClassNameSlash());
                    mv.visitInsn(DUP);
                    mv.visitLdcInsn("Field " + f.getName()
                            + " cannot be accessed: not loaded when the object has been detached");
                    mv.visitMethodInsn(INVOKESPECIAL, personality.getDetachedFieldAccessExceptionClassNameSlash(), "<init>", "(Ljava/lang/String;)V");
                    mv.visitInsn(ATHROW);
View Full Code Here

        //The po is activated
        //Logger logger = ((org.objectweb.jorm.util.api.Loggable) getPClassMapping()).getLogger();
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite, "getPClassMapping",
                "()Lorg/objectweb/jorm/api/PClassMapping;");
        mv.visitTypeInsn(CHECKCAST, "org/objectweb/jorm/util/api/Loggable");
        mv.visitMethodInsn(INVOKEINTERFACE, "org/objectweb/jorm/util/api/Loggable",
                "getLogger", "()Lorg/objectweb/util/monolog/api/Logger;");
        final int loggerIdx = nextLocalVarIdx;
        nextLocalVarIdx++;
        mv.visitVarInsn(ASTORE, loggerIdx);
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.