Example usage for org.objectweb.asm MethodVisitor visitLdcInsn

List of usage examples for org.objectweb.asm MethodVisitor visitLdcInsn

Introduction

In this page you can find the example usage for org.objectweb.asm MethodVisitor visitLdcInsn.

Prototype

public void visitLdcInsn(final Object value) 

Source Link

Document

Visits a LDC instruction.

Usage

From source file:org.alkemy.instr.GetterSetterWriter.java

License:Open Source License

private static void appendSetter(ClassWriter cw, String className, String fieldName,
        FieldProperties fieldProperties, String methodName, MethodProperties methodProperties) {
    if (!hasSetter(fieldProperties.desc, methodProperties)) {
        // typified
        appendSetter(cw, className, fieldName, fieldProperties.desc, methodName, fieldProperties.isStatic);

        if (fieldProperties.isEnum && !hasSetter("Ljava/lang/String;", methodProperties)) {
            // String support
            final MethodVisitor mv = cw.visitMethod(
                    fieldProperties.isStatic ? ACC_PUBLIC + ACC_STATIC : ACC_PUBLIC, methodName,
                    "(" + "Ljava/lang/String;" + ")V", null, null);
            if (fieldProperties.isStatic) {
                mv.visitLdcInsn(Type.getType(fieldProperties.desc));
                mv.visitVarInsn(ALOAD, 0);
            } else {
                mv.visitVarInsn(ALOAD, 0);
                mv.visitLdcInsn(Type.getType(fieldProperties.desc));
                mv.visitVarInsn(ALOAD, 1);
            }/*from w  w  w  .jav  a 2s . c om*/
            mv.visitMethodInsn(INVOKESTATIC, "org/alkemy/instr/AlkemizerUtils$Proxy", "toEnum",
                    "(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;", false);
            mv.visitTypeInsn(CHECKCAST, AlkemizerUtils.toClassNameFromDesc(fieldProperties.desc));
            mv.visitFieldInsn(fieldProperties.isStatic ? PUTSTATIC : PUTFIELD, className, fieldName,
                    fieldProperties.desc);
            mv.visitInsn(RETURN);
            mv.visitMaxs(0, 0);
            mv.visitEnd();
        }
    }
}

From source file:org.apache.commons.jci.classes.ExtendedDump.java

License:Apache License

public static byte[] dump() throws Exception {

    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    MethodVisitor mv;

    cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "jci/Extended", null, "jci/Simple", null);

    cw.visitSource("Extended.java", null);

    {/*  w w  w  . java2 s . co  m*/
        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        mv.visitLabel(l0);
        mv.visitLineNumber(3, l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "jci/Simple", "<init>", "()V");
        mv.visitInsn(RETURN);
        Label l1 = new Label();
        mv.visitLabel(l1);
        mv.visitLocalVariable("this", "Ljci/Extended;", null, l0, l1, 0);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        mv.visitLabel(l0);
        mv.visitLineNumber(6, l0);
        mv.visitTypeInsn(NEW, "java/lang/StringBuffer");
        mv.visitInsn(DUP);
        mv.visitLdcInsn("Extended:");
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuffer", "<init>", "(Ljava/lang/String;)V");
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "jci/Simple", "toString", "()Ljava/lang/String;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "append",
                "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "toString", "()Ljava/lang/String;");
        mv.visitInsn(ARETURN);
        Label l1 = new Label();
        mv.visitLabel(l1);
        mv.visitLocalVariable("this", "Ljci/Extended;", null, l0, l1, 0);
        mv.visitMaxs(3, 1);
        mv.visitEnd();
    }
    cw.visitEnd();

    return cw.toByteArray();
}

From source file:org.apache.commons.jci.classes.SimpleDump.java

License:Apache License

public static byte[] dump(final String to) throws Exception {

    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    MethodVisitor mv;

    cw.visit(V1_4, ACC_PUBLIC + ACC_SUPER, "jci/Simple", null, "java/lang/Object", null);

    cw.visitSource("Simple.java", null);

    {/* www .j  av a2  s . c  o  m*/
        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        Label l0 = new Label();
        mv.visitLabel(l0);
        mv.visitLineNumber(3, l0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
        mv.visitInsn(RETURN);
        Label l1 = new Label();
        mv.visitLabel(l1);
        mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    {
        mv = cw.visitMethod(ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null);
        mv.visitCode();
        Label l0 = new Label();
        mv.visitLabel(l0);
        mv.visitLineNumber(6, l0);
        mv.visitLdcInsn(to);
        mv.visitInsn(ARETURN);
        Label l1 = new Label();
        mv.visitLabel(l1);
        mv.visitLocalVariable("this", "Ljci/Simple;", null, l0, l1, 0);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }
    cw.visitEnd();

    return cw.toByteArray();
}

From source file:org.apache.cxf.jaxb.WrapperHelperCompiler.java

License:Apache License

private boolean addSignature() {
    String sig = computeSignature();
    if (sig == null) {
        return false;
    }//from w w  w  . ja v a 2  s . c o m
    MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getSignature", "()Ljava/lang/String;", null, null);
    mv.visitCode();
    mv.visitLdcInsn(sig);
    Label l0 = new Label();
    mv.visitLabel(l0);
    mv.visitLineNumber(100, l0);
    mv.visitInsn(Opcodes.ARETURN);
    mv.visitMaxs(0, 0);
    mv.visitEnd();
    return true;
}

From source file:org.apache.cxf.jaxb.WrapperHelperCompiler.java

License:Apache License

private void doCollection(MethodVisitor mv, int x) {
    // List aVal = obj.getA();
    // List newA = (List)lst.get(99);
    // if (aVal == null) {
    // obj.setA(newA);
    // } else if (newA != null) {
    // aVal.addAll(newA);
    // }// ww  w.j  a  va2s.  c  o  m

    Label l3 = new Label();
    mv.visitLabel(l3);
    mv.visitLineNumber(114, l3);

    mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, periodToSlashes(wrapperType.getName()), getMethods[x].getName(),
            getMethodSignature(getMethods[x]));
    mv.visitVarInsn(Opcodes.ASTORE, 3);
    mv.visitVarInsn(Opcodes.ALOAD, 1);
    mv.visitIntInsn(Opcodes.BIPUSH, x);
    mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "get", "(I)Ljava/lang/Object;");
    mv.visitTypeInsn(Opcodes.CHECKCAST, "java/util/List");
    mv.visitVarInsn(Opcodes.ASTORE, 4);
    mv.visitVarInsn(Opcodes.ALOAD, 3);
    Label nonNullLabel = new Label();
    mv.visitJumpInsn(Opcodes.IFNONNULL, nonNullLabel);

    if (setMethods[x] == null) {
        mv.visitTypeInsn(Opcodes.NEW, "java/lang/RuntimeException");
        mv.visitInsn(Opcodes.DUP);
        mv.visitLdcInsn(getMethods[x].getName() + " returned null and there isn't a set method.");
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/RuntimeException", "<init>",
                "(Ljava/lang/String;)V");
        mv.visitInsn(Opcodes.ATHROW);
    } else {
        mv.visitVarInsn(Opcodes.ALOAD, 2);
        mv.visitVarInsn(Opcodes.ALOAD, 4);
        mv.visitTypeInsn(Opcodes.CHECKCAST, getMethods[x].getReturnType().getName().replace('.', '/'));
        mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, periodToSlashes(wrapperType.getName()),
                setMethods[x].getName(), getMethodSignature(setMethods[x]));
    }
    Label jumpOverLabel = new Label();
    mv.visitJumpInsn(Opcodes.GOTO, jumpOverLabel);
    mv.visitLabel(nonNullLabel);
    mv.visitLineNumber(106, nonNullLabel);

    mv.visitVarInsn(Opcodes.ALOAD, 4);
    mv.visitJumpInsn(Opcodes.IFNULL, jumpOverLabel);
    mv.visitVarInsn(Opcodes.ALOAD, 3);
    mv.visitVarInsn(Opcodes.ALOAD, 4);
    mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/List", "addAll", "(Ljava/util/Collection;)Z");
    mv.visitInsn(Opcodes.POP);
    mv.visitLabel(jumpOverLabel);
    mv.visitLineNumber(107, jumpOverLabel);
}

From source file:org.apache.directmemory.lightning.internal.generator.BytecodeMarshallerGenerator.java

License:Apache License

private void createConstructor(ClassWriter cw, String className, List<PropertyDescriptor> propertyDescriptors) {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", MARSHALLER_CONSTRUCTOR_SIGNATURE, null, null);
    mv.visitCode();/*  w ww.  j av  a2 s.  c o m*/

    // Load this
    mv.visitVarInsn(ALOAD, 0);

    // Load first parameter type (Class)
    mv.visitVarInsn(ALOAD, 1);

    // Load second parameter type (Map)
    mv.visitVarInsn(ALOAD, 2);

    // Load third parameter type (ClassDescriptorAwaySerializer)
    mv.visitVarInsn(ALOAD, 3);

    // Load fourth parameter type (ObjenesisSerializer)
    mv.visitVarInsn(ALOAD, 4);

    // Call super(Class, Map)
    mv.visitMethodInsn(INVOKESPECIAL, SUPER_CLASS_INTERNAL_TYPE, "<init>",
            MARSHALLER_SUPER_CONSTRUCTOR_SIGNATURE);

    // Fill fields with marshallers
    for (int i = 0; i < propertyDescriptors.size(); i++) {
        PropertyDescriptor propertyDescriptor = propertyDescriptors.get(i);
        String fieldName = toFinalFieldName("marshaller", propertyDescriptor);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 0);

        // Load property type
        mv.visitVarInsn(ALOAD, 5);
        mv.visitIntInsn(BIPUSH, i);
        mv.visitMethodInsn(INVOKEINTERFACE, LIST_CLASS_INTERNAL_TYPE, "get", "(I)Ljava/lang/Object;");

        // Store PropertyDescriptor
        mv.visitTypeInsn(CHECKCAST, PROPERTYDESCRIPTOR_CLASS_INTERNAL_TYPE);
        mv.visitFieldInsn(PUTFIELD, className, toFinalFieldName("descriptor", propertyDescriptor),
                PROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);

        if (propertyDescriptor.getType().isArray()
                && !propertyDescriptor.getType().getComponentType().isPrimitive()) {
            Label labelNonNull = new Label();

            // Get type from PropertyAccessor
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, className, toFinalFieldName("descriptor", propertyDescriptor),
                    PROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);
            mv.visitMethodInsn(INVOKEINTERFACE, PROPERTYDESCRIPTOR_CLASS_INTERNAL_TYPE, "getType",
                    "()Ljava/lang/Class;");

            // Get array component type
            mv.visitMethodInsn(INVOKEVIRTUAL, CLASS_CLASS_INTERNAL_TYPE, "getComponentType",
                    CLASS_GET_COMPONENT_TYPE);
            mv.visitVarInsn(ASTORE, 9);

            // Generate cheating PropertyDescriptor for component type
            mv.visitVarInsn(ALOAD, 0);
            mv.visitTypeInsn(NEW, CHEATINGPROPERTYDESCRIPTOR_CLASS_INTERNAL_TYPE);
            mv.visitInsn(DUP);
            mv.visitLdcInsn(propertyDescriptor.getPropertyName() + "Element");
            mv.visitVarInsn(ALOAD, 9);
            mv.visitInsn(ACONST_NULL);
            mv.visitMethodInsn(INVOKESPECIAL, CHEATINGPROPERTYDESCRIPTOR_CLASS_INTERNAL_TYPE, "<init>",
                    CHEATINGPROPERTYDESCRIPTOR_CONSTRUCTOR);
            mv.visitFieldInsn(PUTFIELD, className, toFinalFieldName("component", propertyDescriptor),
                    CHEATINGPROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);

            // Search marshaller by using interal ones
            mv.visitVarInsn(ALOAD, 6);
            mv.visitVarInsn(ALOAD, 9);
            mv.visitInsn(ACONST_NULL);
            mv.visitMethodInsn(INVOKEINTERFACE, MARSHALLERSTRATEGY_CLASS_INTERNAL_TYPE, "getMarshaller",
                    MARSHALLERSTRATEGY_GET_MARSHALLER_SIGNATURE);
            mv.visitVarInsn(ASTORE, 8);
            mv.visitVarInsn(ALOAD, 8);

            // Search marshaller for property type
            mv.visitJumpInsn(IFNONNULL, labelNonNull);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, className, toFinalFieldName("component", propertyDescriptor),
                    CHEATINGPROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);
            mv.visitMethodInsn(INVOKEVIRTUAL, SUPER_CLASS_INTERNAL_TYPE, "findMarshaller",
                    MARSHALLER_FIND_MARSHALLER_SIGNATURE);
            mv.visitVarInsn(ASTORE, 8);

            // Save marshaller to field
            mv.visitLabel(labelNonNull);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 8);
            mv.visitFieldInsn(PUTFIELD, className, toFinalFieldName("marshaller", propertyDescriptor),
                    MARSHALLER_CLASS_DESCRIPTOR);
        } else {
            // Check if marshaller is defined
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitFieldInsn(GETFIELD, className, toFinalFieldName("descriptor", propertyDescriptor),
                    PROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);
            mv.visitMethodInsn(INVOKEVIRTUAL, SUPER_CLASS_INTERNAL_TYPE, "findMarshaller",
                    MARSHALLER_FIND_MARSHALLER_SIGNATURE);
            mv.visitFieldInsn(PUTFIELD, className, fieldName, MARSHALLER_CLASS_DESCRIPTOR);
        }

        // Load this to method stack
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(DUP);

        // Load property accessor
        mv.visitFieldInsn(GETFIELD, className, toFinalFieldName("descriptor", propertyDescriptor),
                PROPERTYDESCRIPTOR_CLASS_DESCRIPTOR);
        mv.visitMethodInsn(INVOKEINTERFACE, PROPERTYDESCRIPTOR_CLASS_INTERNAL_TYPE, "getPropertyAccessor",
                PROPERTY_DESCRIPTOR_GET_PROPERTYACCESSOR_SIGNATURE);

        // Save PropertyAccessor to field
        mv.visitFieldInsn(PUTFIELD, className, toFinalFieldName("accessor", propertyDescriptor),
                PROPERTYACCESSOR_CLASS_DESCRIPTOR);
    }

    mv.visitInsn(RETURN);
    mv.visitMaxs(-1, 12);
    mv.visitEnd();
}

From source file:org.apache.felix.ipojo.composite.service.provides.POJOWriter.java

License:Apache License

/**
 * Generate Optional Case for aggregate field.
 * @param mv : method visitor/*from  w  w  w  . j a v a  2  s .  c om*/
 * @param delegator : Field on which delegate
 * @param className : current class name
 */
private static void generateOptionalAggregateCase(MethodVisitor mv, FieldMetadata delegator, String className) {
    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, className, delegator.getName(),
            "[L" + delegator.getSpecification().getName().replace('.', '/') + ";");
    mv.visitInsn(ARRAYLENGTH);
    Label l1a = new Label();
    mv.visitJumpInsn(IFNE, l1a);
    Label l2a = new Label();
    mv.visitLabel(l2a);
    mv.visitTypeInsn(NEW, "java/lang/UnsupportedOperationException");
    mv.visitInsn(DUP);
    mv.visitLdcInsn("Operation not supported");
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/UnsupportedOperationException", "<init>",
            "(Ljava/lang/String;)V");
    mv.visitInsn(ATHROW);
    mv.visitLabel(l1a);
}

From source file:org.apache.felix.ipojo.composite.service.provides.POJOWriter.java

License:Apache License

/**
 * Generate Optional case for non aggregate fields.
 * /*from   w ww . ja  va  2 s  .c o m*/
 * @param mv : the method visitor
 * @param delegator : the field on which delegate.
 * @param className : the name of the current class.
 */
private static void generateOptionalCase(MethodVisitor mv, FieldMetadata delegator, String className) {
    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, className, delegator.getName(),
            "L" + delegator.getSpecification().getName().replace('.', '/') + ";");
    mv.visitTypeInsn(INSTANCEOF, "org/apache/felix/ipojo/Nullable");
    Label end = new Label();
    mv.visitJumpInsn(IFEQ, end);
    Label begin = new Label();
    mv.visitLabel(begin);
    mv.visitTypeInsn(NEW, "java/lang/UnsupportedOperationException");
    mv.visitInsn(DUP);
    mv.visitLdcInsn("Operation not supported");
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/UnsupportedOperationException", "<init>",
            "(Ljava/lang/String;)V");
    mv.visitInsn(ATHROW);
    mv.visitLabel(end);
}

From source file:org.apache.felix.ipojo.manipulation.ClassManipulator.java

License:Apache License

/**
 * Create the setter method for the __cm field.
 *//*from   w  w  w .  ja  va 2 s  .  c  o m*/
private void createSetInstanceManagerMethod() {
    MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_setInstanceManager",
            "(Lorg/apache/felix/ipojo/InstanceManager;)V", null, null);
    mv.visitCode();

    // If the given instance manager is null, just returns.
    mv.visitVarInsn(ALOAD, 1);
    Label l1 = new Label();
    mv.visitJumpInsn(IFNONNULL, l1);
    mv.visitInsn(RETURN);
    mv.visitLabel(l1);

    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitFieldInsn(PUTFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");

    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
    mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredFields",
            "()Ljava/util/Set;", false);
    mv.visitVarInsn(ASTORE, 2);

    mv.visitVarInsn(ALOAD, 2);
    Label endif = new Label();
    mv.visitJumpInsn(IFNULL, endif);
    for (String field : m_fields) {
        mv.visitVarInsn(ALOAD, 2);
        mv.visitLdcInsn(field);
        mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true);
        Label l3 = new Label();
        mv.visitJumpInsn(IFEQ, l3);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(ICONST_1);
        mv.visitFieldInsn(PUTFIELD, m_owner, FIELD_FLAG_PREFIX + field, "Z");
        mv.visitLabel(l3);
    }
    mv.visitLabel(endif);

    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
    mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredMethods",
            "()Ljava/util/Set;", false);
    mv.visitVarInsn(ASTORE, 2);

    mv.visitVarInsn(ALOAD, 2);
    Label endif2 = new Label();
    mv.visitJumpInsn(IFNULL, endif2);

    for (String methodId : m_methods) {
        if (!methodId.equals("<init>")) {
            mv.visitVarInsn(ALOAD, 2);
            mv.visitLdcInsn(methodId);
            mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true);
            Label l3 = new Label();
            mv.visitJumpInsn(IFEQ, l3);
            mv.visitVarInsn(ALOAD, 0);
            mv.visitInsn(ICONST_1);
            mv.visitFieldInsn(PUTFIELD, m_owner, METHOD_FLAG_PREFIX + methodId, "Z");
            mv.visitLabel(l3);
        }
    }

    mv.visitLabel(endif2);
    mv.visitInsn(RETURN);

    mv.visitMaxs(0, 0);
    mv.visitEnd();
}

From source file:org.apache.felix.ipojo.manipulation.ClassManipulator.java

License:Apache License

/**
 * Create a getter method for an array./*from   ww w  . j av a 2 s.  co m*/
 * @param name : field name
 * @param desc : method description
 */
private void createArraySetter(String name, String desc) {
    MethodVisitor mv = cv.visitMethod(0, "__set" + name, desc, null, null);
    mv.visitCode();

    String internalType = desc.substring(1);
    internalType = internalType.substring(0, internalType.length() - 2);

    Label l1 = new Label();
    mv.visitLabel(l1);
    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z");
    Label l2 = new Label();
    mv.visitJumpInsn(IFNE, l2);

    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitFieldInsn(PUTFIELD, m_owner, name, internalType);
    mv.visitInsn(RETURN);
    mv.visitLabel(l2);

    mv.visitVarInsn(ALOAD, 0);
    mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
    mv.visitVarInsn(ALOAD, 0);
    mv.visitLdcInsn(name);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET,
            "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);

    mv.visitInsn(RETURN);

    // End
    mv.visitMaxs(0, 0);
    mv.visitEnd();
}