Package org.objectweb.asm.commons

Examples of org.objectweb.asm.commons.GeneratorAdapter.visitCode()


  GeneratorAdapter newMethod( int _access, String _name, String _descriptor )
  {
    MethodVisitor mv = cw().visitMethod( _access, _name, _descriptor, null, null );
    GeneratorAdapter ma = new GeneratorAdapter( mv, _access, _name, _descriptor );
    ma.visitCode();
    return ma;
  }

  void endMethod( GeneratorAdapter _mv )
  {
View Full Code Here


     * @param paramAnnotations : the parameter annotations to move to this method.
     */
    private void generateMethodHeader(int access, String name, String desc, String signature, String[] exceptions, List annotations, Map paramAnnotations) {
        GeneratorAdapter mv = new GeneratorAdapter(cv.visitMethod(access, name, desc, signature, exceptions), access, name, desc);

        mv.visitCode();

        Type returnType = Type.getReturnType(desc);

        // Compute result and exception stack location
        int result = -1;
View Full Code Here

                 access, "<init>", descriptor);
         // Compute the new signature
         String newDesc = descriptor.substring(1); // Remove the first (
         newDesc = "(Lorg/apache/felix/ipojo/InstanceManager;" + newDesc;

         mv.visitCode();
         mv.visitVarInsn(ALOAD, 0);
         mv.visitInsn(ACONST_NULL);
         mv.loadArgs();
         mv.visitMethodInsn(INVOKESPECIAL, m_owner, "<init>", newDesc);
         mv.visitInsn(RETURN);
View Full Code Here


  private void buildDefaultConstructor( Type _parentType )
  {
    GeneratorAdapter mv = newMethod( Opcodes.ACC_PUBLIC, "<init>", ENV_CONSTRUCTOR_SIG );
    mv.visitCode();
    mv.loadThis();
    mv.visitMethodInsn( Opcodes.INVOKESPECIAL, _parentType.getInternalName(), "<init>", "()V" );
    mv.loadThis();
    mv.loadArg( 0 );
    mv.putField( this.classType(), ByteCodeEngineCompiler.ENV_MEMBER_NAME, ByteCodeEngineCompiler.ENV_CLASS );
View Full Code Here

    // Constructor
    GeneratorAdapter gen = new GeneratorAdapter(visitor.visitMethod(
        Opcodes.ACC_PUBLIC, "<init>", "()V", null, new String[0]),
        Opcodes.ACC_PUBLIC, "<init>", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.invokeConstructor(Type.getType(Object.class), new Method("<init>",
        "()V"));
    gen.returnValue();
    gen.visitMaxs(0, 0);
View Full Code Here

    // Constructor
    GeneratorAdapter gen = new GeneratorAdapter(writer.visitMethod(
        Opcodes.ACC_PUBLIC, "<init>", "()V", null, new String[0]),
        Opcodes.ACC_PUBLIC, "<init>", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.invokeConstructor(Type.getType(Object.class), new Method("<init>",
        "()V"));
    gen.loadThis();
    final int size = runtime.generateDataAccessor(classid, className, 2,
View Full Code Here

    // get()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC,
        "get", "()[Z", null, new String[0]), Opcodes.ACC_PUBLIC, "get",
        "()[Z");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
    gen.returnValue();
    gen.visitMaxs(1, 0);
    gen.visitEnd();
View Full Code Here

    gen.visitEnd();

    // a()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC, "a",
        "()V", null, new String[0]), Opcodes.ACC_PUBLIC, "a", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
    gen.push(0);
    gen.push(1);
    gen.arrayStore(Type.BOOLEAN_TYPE);
View Full Code Here

    gen.visitEnd();

    // b()
    gen = new GeneratorAdapter(writer.visitMethod(Opcodes.ACC_PUBLIC, "b",
        "()V", null, new String[0]), Opcodes.ACC_PUBLIC, "b", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.getField(classType, "data", Type.getObjectType("[Z"));
    gen.push(1);
    gen.push(1);
    gen.arrayStore(Type.BOOLEAN_TYPE);
View Full Code Here

    // Constructor
    GeneratorAdapter gen = new GeneratorAdapter(writer.visitMethod(
        Opcodes.ACC_PUBLIC, "<init>", "()V", null, new String[0]),
        Opcodes.ACC_PUBLIC, "<init>", "()V");
    gen.visitCode();
    gen.loadThis();
    gen.invokeConstructor(Type.getType(Object.class), new Method("<init>",
        "()V"));
    gen.loadThis();
    final int size = runtime.generateDataAccessor(classid, gen);
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.