Package org.objectweb.asm

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


                                   final Attribute attrs) {
        CodeVisitor c = cv.visitMethod(access, name, desc, exceptions, attrs);
        if (name.equals("<init>")) {
            c.visitVarInsn(Constants.ALOAD, 0);
            c.visitLdcInsn(speedoClass.getFQName()); //load a constant
            c.visitFieldInsn(Constants.PUTFIELD, className,
                ADDED_FIELD_NAME, ADDED_FIELD_DESC);
        }
        return c;
    }
View Full Code Here


            Util.visitIntConstant(mv, DetachedLifeCycle.DETACHED_NONE);
            mv.visitInsn(I2B);
            mv.visitJumpInsn(IF_ICMPEQ, l1);
            // && !(($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");
View Full Code Here

        mv.visitTypeInsn(CHECKCAST, xfieldsJCN);
        mv.visitVarInsn(ASTORE, 1);

        //return sa.f1;
        mv.visitVarInsn(ALOAD, 1);
        mv.visitFieldInsn(GETFIELD, xfieldsJCN, f.getName(), ftd);
        mv.visitInsn(ft.getOpcode(IRETURN));
        mv.visitMaxs(0, 0);
    }

    private void generateFieldSetter(Field f, Type ft, String ftd, int nbField) {
View Full Code Here

            Label l3 = new Label();
            mv.visitJumpInsn(IF_ICMPEQ, l3);
            {
                //if (!(($classNameFields) speedoReferenceState).${f.name}Loaded ) {
                generateGetRefState(mv, true);
                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());
View Full Code Here

            }
            mv.visitLabel(l3);
            //(($classNameFields) speedoReferenceState).${f.name} = val;
            generateGetRefState(mv, true);
            mv.visitVarInsn(ft.getOpcode(ILOAD), 1);
            mv.visitFieldInsn(PUTFIELD, xfieldsJCN, f.getName(), ftd);

            //return
            mv.visitInsn(RETURN);
        }
View Full Code Here

        if (f.getIsReference()) {
            generateReferenceSetter(f, ft, nbField, loggerIdx, stateIdx, nextLocalVarIdx, mv);
        } else {
            mv.visitVarInsn(ALOAD, stateIdx);
            mv.visitVarInsn(ft.getOpcode(ILOAD), 1);
            mv.visitFieldInsn(PUTFIELD, xfieldsJCN, f.getName(), ftd);
        }
        mv.visitInsn(RETURN);
        mv.visitMaxs(0, 0);
    }
    /**
 
View Full Code Here

            if (wrapper != null) {
                mv.visitTypeInsn(NEW, wrapper);
                mv.visitInsn(DUP);
            }
            generateGetRefState(mv, true);
            mv.visitFieldInsn(GETFIELD, xfieldsJCN, fieldName, jvmFieldType);
            if (wrapper != null) {
                mv.visitMethodInsn(INVOKESPECIAL, wrapper, "<init>",
                        "(" + jvmFieldType + ")V");
            }
        }
View Full Code Here

                "()Lorg/objectweb/speedo/pm/api/POManagerItf;", null, null);
        //return (speedoIsActive
                //? speedoGetHome().getPOManagerFactory().lookup()
                //: null);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, classToWrite, ISACTIVE_FIELD_NAME, "Z");
        Label l1 = new Label();
        mv.visitJumpInsn(IFEQ, l1);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKEVIRTUAL, classToWrite, "speedoGetHome",
                "()" + JT_HOME);
View Full Code Here

        cv.visitMaxs(0, 0);
    }
    private void generateGetVersioningStrategy(HomeContext gc) {
        CodeVisitor cv = gc.cv.visitMethod(ACC_PUBLIC + ACC_FINAL,
                "getVersioningStrategy", "()B", null, null);
        cv.visitFieldInsn(GETSTATIC, gc.classToWriteJCN, "VERSIONING_STRATEGY", "B");
        cv.visitInsn(IRETURN);
        cv.visitMaxs(1, 1);
    }
    private void generateIsDetachable(HomeContext gc) {
        CodeVisitor cv = gc.cv.visitMethod(ACC_PUBLIC + ACC_FINAL,
View Full Code Here

        cv.visitMaxs(1, 1);
    }
    private void generateIsDetachable(HomeContext gc) {
        CodeVisitor cv = gc.cv.visitMethod(ACC_PUBLIC + ACC_FINAL,
                "isDetachable", "()Z", null, null);
        cv.visitFieldInsn(GETSTATIC, gc.classToWriteJCN, "DETACHABLE", "Z");
        cv.visitInsn(IRETURN);
        cv.visitMaxs(1, 1);
    }
    private void generateIsAbstract(HomeContext gc) {
        if (gc.sc.isAbstract) {
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.