Package org.objectweb.asm

Examples of org.objectweb.asm.ClassWriter.toByteArray()


                createMethod(writer, className, referenceName, fieldName, typeName, false);
            }

            final FileOutputStream fos = new FileOutputStream(fileName);
            fos.write(writer.toByteArray());
            fos.close();
        } catch (final Exception e) {
            throw new SCRDescriptorException("Unable to add methods to " + className, typeName, e);
        }
    }
View Full Code Here


      data.accept(analysis);
    } catch (Error e) {
      e.printStackTrace();
    }

    byte[] byteArray = cw.toByteArray();

     // to emit pre-kilim code [for debugging] 
    repo.store("raw/"+cv.getInternalClassName(), byteArray);

    boolean written = false;
View Full Code Here

    // create set
    create_tuple_set(num_cells, cw, this_class_name);

    cw.visitEnd();
    byte[] data = cww.toByteArray();

    // dump(this_class_name, data);

    return data;
  }
View Full Code Here

        make_cast_method(cw, arity);

        cw.visitEnd();

        byte[] data = cw.toByteArray();
        return data;
    }

    static Map<String, Constructor<? extends EFun>> handlers = new HashMap<String, Constructor<? extends EFun>>();
    static final Pattern JAVA_ID = Pattern.compile("([a-z]|[A-Z]|$|_|[0-9])*"); // valid java identifier
View Full Code Here

            make_invoke_method(cw, self_type, arity);
            make_go_method(cw, self_type, arity);
            make_encode_method(cw, self_type, arity);

            cw.visitEnd();
            byte[] data = cw.toByteArray();

            data = weave(data);

            Class<? extends EFun> clazz = ERT.defineClass(loader, self_type.replace('/', '.'), data);
View Full Code Here

        make_encode_method_for_exported(cw, self_type, arity);

        cw.visitEnd();

        byte[] data = cw.toByteArray();
        return data;
    }


    static void make_encode_method_for_exported(ClassWriter cw, String className, int arity) {
View Full Code Here

        mv.visitInsn(Opcodes.RETURN);
        mv.visitMaxs(1, 1);
        mv.visitEnd();
        cw.visitEnd();

        byte[] data = cw.toByteArray();
        return data;
    }

    private static void make_invoke_method_for_guard(ClassWriter cw, String className, int arity) {
        MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "invoke", EUtil
View Full Code Here

    SpecificationClassAdapter adapter =
        new SpecificationClassAdapter(writer, contracts);
    reader.accept(adapter, ClassReader.EXPAND_FRAMES);

    return writer.toByteArray();
  }

  /**
   * Instruments the passed class file so that it contains debug
   * information extraction from annotations.
View Full Code Here

  @Ensures("result != null")
  private byte[] instrumentWithDebug(byte[] bytecode) {
    ClassReader reader = new ClassReader(bytecode);
    ClassWriter writer = new NonLoadingClassWriter(reader, 0);
    reader.accept(new HelperClassAdapter(writer), ClassReader.EXPAND_FRAMES);
    return writer.toByteArray();
  }
}
View Full Code Here

            if (COMPACT_CONSTANTS) {
              Set<Constant> constants = new TreeSet<Constant>(new ConstantComparator());
              constants.addAll(cp.values());

              cr = new ClassReader(cw.toByteArray());
                cw = new ClassWriter(false);
                for(Constant c: constants)
                  c.write(cw);
                cr.accept(cw, false);
            }
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.