Package org.objectweb.asm

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


            }
        }

        cw.visitEnd();

        return cw.toByteArray();

    }

    /**
     * Generates a delegated method.
View Full Code Here


                cw.visitMethod(ACC_PUBLIC + ACC_ABSTRACT, methodName, '(' + inputSignature.toString() + ')' + outputSignature, null, null).visitEnd();
            }

            // Generate the bytecodes
            cw.visitEnd();
            byte[] bytes = cw.toByteArray();

            // Add the class to the resource loader

            return resourceLoader.addClass(bytes);
           
View Full Code Here

        reader = new ClassReader( new ByteArrayInputStream( classfileBuffer ) );
        new TransformingClassGenerator(
            new ClassReaderGenerator( reader, attributes(), skipDebug() ), t
        ).generateClass( w );
        out = new ByteArrayOutputStream();
        out.write( w.toByteArray() );
        result = out.toByteArray();
        out.close();
      }
      catch (Exception e) {
        log.error( "Unable to transform class", e );
View Full Code Here

        "java/lang/Object", new String[] { "org/renjin/compiler/runtime/PackageLoader" });

    writeInit(cw);
    writeLoadMethod(cw, packageName, packageEnvironment);
   
    return cw.toByteArray();
  }

  private static void writeInit(ClassWriter cw) {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
View Full Code Here

    writeConstructor();
    writeCompute(node);

    cv.visitEnd();

    byte[] classBytes = cw.toByteArray();
    long compileTime = System.nanoTime() - startTime;

    Class jitClass = new MyClassLoader().defineClass(className, classBytes);

    long loadTime = System.nanoTime() - startTime - compileTime;
View Full Code Here

    mg.returnValue();
   
    mg.endMethod();
    cw.visitEnd();

    wovenClass.setBytes(cw.toByteArray());
  }

  public static boolean hasWeavingEnabled() {
    return weavingEnabled == 1 ? true : false;
  }
View Full Code Here

    public WovenClassImpl(Class clazz) {
      try {
        ClassReader cr = new ClassReader(clazz.getName());
        ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cr.accept(cw, 0);
        bytes = cw.toByteArray();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
View Full Code Here

        reader = new ClassReader( new ByteArrayInputStream( classfileBuffer ) );
        new TransformingClassGenerator(
            new ClassReaderGenerator( reader, skipDebug() ), t
        ).generateClass( w );
        out = new ByteArrayOutputStream();
        out.write( w.toByteArray() );
        result = out.toByteArray();
        out.close();
      }
      catch (Exception e) {
        log.error( "Unable to transform class", e );
View Full Code Here

        reader = new ClassReader( new ByteArrayInputStream( classfileBuffer ) );
        new TransformingClassGenerator(
            new ClassReaderGenerator( reader, skipDebug() ), t
        ).generateClass( w );
        out = new ByteArrayOutputStream();
        out.write( w.toByteArray() );
        result = out.toByteArray();
        out.close();
      }
      catch (Exception e) {
        log.error( "Unable to transform class", e );
View Full Code Here

        reader = new ClassReader( new ByteArrayInputStream( classfileBuffer ) );
        new TransformingClassGenerator(
            new ClassReaderGenerator( reader, attributes(), skipDebug() ), t
        ).generateClass( w );
        out = new ByteArrayOutputStream();
        out.write( w.toByteArray() );
        result = out.toByteArray();
        out.close();
      }
      catch (Exception e) {
        log.error( "Unable to transform class", e );
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.