harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjanu...@apache.org
Subject svn commit: r763657 - /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/
Date Thu, 09 Apr 2009 14:03:21 GMT
Author: sjanuary
Date: Thu Apr  9 14:03:20 2009
New Revision: 763657

URL: http://svn.apache.org/viewvc?rev=763657&view=rev
Log:
Pack200 - add framework for packing with different effort

Modified:
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
    harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
Thu Apr  9 14:03:20 2009
@@ -109,7 +109,7 @@
                     if (!added) { // not added because segment has reached
                         // maximum size
                         if(classes.size() > 0 || files.size() > 0) {
-                            new Segment().pack(classes, files, outputStream, stripDebug);
+                            new Segment().pack(classes, files, outputStream, stripDebug,
effort);
                             classes = new ArrayList();
                             files = new ArrayList();
                             currentSegmentSize = 0;
@@ -118,7 +118,7 @@
                         }
                     } else if (segmentLimit == 0 && estimateSize(jarEntry) > 0)
{
                         // create a new segment for each class unless size = 0
-                        new Segment().pack(classes, files, outputStream, stripDebug);
+                        new Segment().pack(classes, files, outputStream, stripDebug, effort);
                         classes = new ArrayList();
                         files = new ArrayList();
                     }
@@ -132,7 +132,7 @@
                             jarFile.getInputStream(jarEntry)), classes, files);
                     if (!added) { // not added because segment has reached maximum
                         // size
-                        new Segment().pack(classes, files, outputStream, stripDebug);
+                        new Segment().pack(classes, files, outputStream, stripDebug, effort);
                         classes = new ArrayList();
                         files = new ArrayList();
                         currentSegmentSize = 0;
@@ -141,14 +141,14 @@
                         currentSegmentSize = 0; // ignore the size of the first entry for
compatibility with the RI
                     } else if (segmentLimit == 0 && estimateSize(jarEntry) > 0)
{
                         // create a new segment for each class unless size = 0
-                        new Segment().pack(classes, files, outputStream, stripDebug);
+                        new Segment().pack(classes, files, outputStream, stripDebug, effort);
                         classes = new ArrayList();
                         files = new ArrayList();
                     }
                 }
             }
             if(classes.size() > 0 || files.size() > 0) {
-                new Segment().pack(classes, files, outputStream, stripDebug);
+                new Segment().pack(classes, files, outputStream, stripDebug, effort);
             }
             outputStream.close();
         }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
Thu Apr  9 14:03:20 2009
@@ -49,7 +49,8 @@
     private final CpBands cpBands;
     private final Segment segment;
 
-    public AttributeDefinitionBands(Segment segment) {
+    public AttributeDefinitionBands(Segment segment, int effort) {
+        super(effort);
         this.segmentHeader = segment.getSegmentHeader();
         this.cpBands = segment.getCpBands();
         this.segment = segment;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
Thu Apr  9 14:03:20 2009
@@ -23,6 +23,12 @@
 
 public abstract class BandSet {
 
+    private final int effort;
+
+    public BandSet(int effort) {
+        this.effort = effort;
+    }
+
     public abstract void pack(OutputStream out) throws IOException, Pack200Exception;
 
     public byte[] encodeScalar(int[] band, BHSDCodec codec) throws Pack200Exception {

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
Thu Apr  9 14:03:20 2009
@@ -33,7 +33,8 @@
     private final CpBands cpBands;
     private final Segment segment;
 
-    public BcBands(CpBands cpBands, Segment segment) {
+    public BcBands(CpBands cpBands, Segment segment, int effort) {
+        super(effort);
         this.cpBands = cpBands;
         this.segment = segment;
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
Thu Apr  9 14:03:20 2009
@@ -116,7 +116,8 @@
 
     private final Map classReferencesInnerClass = new HashMap();
 
-    public ClassBands(Segment segment, int numClasses) {
+    public ClassBands(Segment segment, int numClasses, int effort) {
+        super(effort);
         this.segment = segment;
         this.header = segment.getSegmentHeader();
         this.cpBands = segment.getCpBands();
@@ -135,15 +136,15 @@
         major_versions = new int[numClasses];
         class_flags = new long[numClasses];
 
-        class_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_CLASS, cpBands);
-        class_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_CLASS, cpBands);
-        field_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_FIELD, cpBands);
-        field_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_FIELD, cpBands);
-        method_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_METHOD,
cpBands);
-        method_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_METHOD,
cpBands);
-        method_RVPA_bands = new MetadataBandGroup("RVPA", MetadataBandGroup.CONTEXT_METHOD,
cpBands);
-        method_RIPA_bands = new MetadataBandGroup("RIPA", MetadataBandGroup.CONTEXT_METHOD,
cpBands);
-        method_AD_bands = new MetadataBandGroup("AD", MetadataBandGroup.CONTEXT_METHOD, cpBands);
+        class_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_CLASS, cpBands,
effort);
+        class_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_CLASS, cpBands,
effort);
+        field_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_FIELD, cpBands,
effort);
+        field_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_FIELD, cpBands,
effort);
+        method_RVA_bands = new MetadataBandGroup("RVA", MetadataBandGroup.CONTEXT_METHOD,
cpBands, effort);
+        method_RIA_bands = new MetadataBandGroup("RIA", MetadataBandGroup.CONTEXT_METHOD,
cpBands, effort);
+        method_RVPA_bands = new MetadataBandGroup("RVPA", MetadataBandGroup.CONTEXT_METHOD,
cpBands, effort);
+        method_RIPA_bands = new MetadataBandGroup("RIPA", MetadataBandGroup.CONTEXT_METHOD,
cpBands, effort);
+        method_AD_bands = new MetadataBandGroup("AD", MetadataBandGroup.CONTEXT_METHOD, cpBands,
effort);
     }
 
     private int index = 0;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
Thu Apr  9 14:03:20 2009
@@ -64,7 +64,8 @@
 
     private final Segment segment;
 
-    public CpBands(Segment segment) {
+    public CpBands(Segment segment, int effort) {
+        super(effort);
         this.segmentHeader = segment.getSegmentHeader();
         this.segment = segment;
         defaultAttributeNames.add("AnnotationDefault");

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
Thu Apr  9 14:03:20 2009
@@ -33,7 +33,8 @@
     private final byte[][] file_bits;
 
     public FileBands(CpBands cpBands, SegmentHeader segmentHeader,
-            List files) {
+            List files, int effort) {
+        super(effort);
         this.segmentHeader = segmentHeader;
         int size =  files.size();
         fileName = new CPUTF8[size];

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
Thu Apr  9 14:03:20 2009
@@ -35,7 +35,8 @@
 
     private final Map outerToInner = new HashMap();
 
-    public IcBands(SegmentHeader segmentHeader, CpBands cpBands) {
+    public IcBands(SegmentHeader segmentHeader, CpBands cpBands, int effort) {
+        super(effort);
         this.segmentHeader = segmentHeader;
         this.cpBands = cpBands;
     }

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MetadataBandGroup.java
Thu Apr  9 14:03:20 2009
@@ -61,7 +61,8 @@
      * Constructs a new MetadataBandGroup
      * @param type - must be either AD, RVA, RIA, RVPA or RIPA.
      */
-    public MetadataBandGroup(String type, int context, CpBands cpBands) {
+    public MetadataBandGroup(String type, int context, CpBands cpBands, int effort) {
+        super(effort);
         this.type = type;
         this.cpBands = cpBands;
         this.context = context;

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
Thu Apr  9 14:03:20 2009
@@ -44,19 +44,21 @@
     private final SegmentMethodVisitor methodVisitor = new SegmentMethodVisitor();
     private Pack200ClassReader currentClassReader;
     private boolean stripDebug;
+    private int effort;
 
-    public void pack(List classes, List files, OutputStream out, boolean stripDebug)
+    public void pack(List classes, List files, OutputStream out, boolean stripDebug, int
effort)
             throws IOException, Pack200Exception {
+        this.effort = effort;
         this.stripDebug = stripDebug;
         segmentHeader = new SegmentHeader();
         segmentHeader.setFile_count(files.size());
         segmentHeader.setHave_all_code_flags(!stripDebug);
-        cpBands = new CpBands(this);
-        attributeDefinitionBands = new AttributeDefinitionBands(this);
-        icBands = new IcBands(segmentHeader, cpBands);
-        classBands = new ClassBands(this, classes.size());
-        bcBands = new BcBands(cpBands, this);
-        fileBands = new FileBands(cpBands, segmentHeader, files);
+        cpBands = new CpBands(this, effort);
+        attributeDefinitionBands = new AttributeDefinitionBands(this, effort);
+        icBands = new IcBands(segmentHeader, cpBands, effort);
+        classBands = new ClassBands(this, classes.size(), effort);
+        bcBands = new BcBands(cpBands, this, effort);
+        fileBands = new FileBands(cpBands, segmentHeader, files, effort);
 
         processClasses(classes);
 

Modified: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java?rev=763657&r1=763656&r2=763657&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
Thu Apr  9 14:03:20 2009
@@ -24,6 +24,10 @@
  */
 public class SegmentHeader extends BandSet {
 
+    public SegmentHeader() {
+        super(1); // Don't do anything special for the header
+    }
+
     private static final int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D };
     private static final int archive_minver = 7;
     private static final int archive_majver = 150;



Mime
View raw message