Index: src/main/java/org/apache/harmony/unpack200/AttributeLayoutMap.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/AttributeLayoutMap.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/AttributeLayoutMap.java (working copy) @@ -24,6 +24,7 @@ import java.util.Map; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Stores a mapping from attribute names to their corresponding layout types. @@ -280,5 +281,10 @@ public NewAttributeBands getAttributeBands(AttributeLayout layout) { return (NewAttributeBands) layoutsToBands.get(layout); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ATTRLAYOUTMAP); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/AttributeLayout.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/AttributeLayout.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/AttributeLayout.java (working copy) @@ -18,6 +18,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.ClassFileEntry; /** @@ -213,6 +214,8 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ATTRLAYOUT); + int PRIME = 31; int r = 1; if (name != null) { @@ -283,4 +286,5 @@ this.backwardsCallCount = backwardsCallCount; } + } Index: src/main/java/org/apache/harmony/unpack200/Segment.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/Segment.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/Segment.java (working copy) @@ -33,6 +33,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.CPField; @@ -98,6 +99,7 @@ private PrintWriter logStream; private ClassFile buildClassFile(int classNum) throws Pack200Exception { + Profiler.markStart(Profiler.SEG_BUILDCF); ClassFile classFile = new ClassFile(); classFile.major = header.getDefaultClassMajorVersion(); // TODO If // classVersionMajor[] use @@ -105,6 +107,8 @@ classFile.minor = header.getDefaultClassMinorVersion(); // TODO if // classVersionMinor[] use // that instead + + // build constant pool ClassConstantPool cp = classFile.pool; int fullNameIndexInCpClass = classBands.getClassThisInts()[classNum]; @@ -113,7 +117,8 @@ int i = fullName.lastIndexOf("/") + 1; // if lastIndexOf==-1, then // -1+1=0, so str.substring(0) // == str - + + Profiler.markStart(Profiler.SEG_BUILDCF_SFATTR); // Get the source file attribute ArrayList classAttributes = classBands.getClassAttributes()[classNum]; SourceFileAttribute sourceFileAttribute = null; @@ -152,7 +157,9 @@ classFile.attributes = new Attribute[] { (Attribute) cp .add(sourceFileAttribute) }; } + Profiler.markStop(Profiler.SEG_BUILDCF_SFATTR); + Profiler.markStart(Profiler.SEG_BUILDCF_CFATTR); // If we see any class attributes, add them to the class's attributes // that will // be written out. Keep SourceFileAttributes out since we just @@ -176,11 +183,14 @@ cp.add(attrib); classFile.attributes[originalAttributes.length + index] = attrib; } + Profiler.markStop(Profiler.SEG_BUILDCF_CFATTR); // this/superclass ClassFileEntry cfThis = cp.add(cpBands.cpClassValue(fullNameIndexInCpClass)); ClassFileEntry cfSuper = cp.add(cpBands.cpClassValue(classBands .getClassSuperInts()[classNum])); + + Profiler.markStart(Profiler.SEG_BUILDCF_INTF); // add interfaces ClassFileEntry cfInterfaces[] = new ClassFileEntry[classBands .getClassInterfacesInts()[classNum].length]; @@ -188,6 +198,9 @@ cfInterfaces[i] = cp.add(cpBands.cpClassValue(classBands .getClassInterfacesInts()[classNum][i])); } + Profiler.markStop(Profiler.SEG_BUILDCF_INTF); + + Profiler.markStart(Profiler.SEG_BUILDCF_FIELDS); // add fields ClassFileEntry cfFields[] = new ClassFileEntry[classBands .getClassFieldCount()[classNum]]; @@ -202,7 +215,10 @@ .getFieldFlags()[classNum][i], classBands .getFieldAttributes()[classNum][i])); } - // add methods + Profiler.markStop(Profiler.SEG_BUILDCF_FIELDS); + + Profiler.markStart(Profiler.SEG_BUILDCF_METHODS); + // add methods ClassFileEntry cfMethods[] = new ClassFileEntry[classBands .getClassMethodCount()[classNum]]; // methodDescr and methodFlags used to create this @@ -217,8 +233,13 @@ .getMethodFlags()[classNum][i], classBands .getMethodAttributes()[classNum][i])); } + Profiler.markStop(Profiler.SEG_BUILDCF_METHODS); + + Profiler.markStart(Profiler.SEG_BUILDCF_ADDNESTED); cp.addNestedEntries(); + Profiler.markStop(Profiler.SEG_BUILDCF_ADDNESTED); + Profiler.markStart(Profiler.SEG_BUILDCF_INNER); // add inner class attribute (if required) boolean addInnerClassesAttr = false; IcTuple[] ic_local = getClassBands().getIcLocal()[classNum]; @@ -283,6 +304,9 @@ classFile.attributes = newAttrs; cp.addWithNestedEntries(innerClassesAttribute); } + Profiler.markStop(Profiler.SEG_BUILDCF_INNER); + + Profiler.markStart(Profiler.SEG_BUILDCF_FINAL); // sort CP according to cp_All cp.resolve(this); // NOTE the indexOf is only valid after the cp.resolve() @@ -297,6 +321,8 @@ } classFile.fields = cfFields; classFile.methods = cfMethods; + Profiler.markStop(Profiler.SEG_BUILDCF_FINAL); + Profiler.markStop(Profiler.SEG_BUILDCF); return classFile; } @@ -366,6 +392,7 @@ */ private void parseSegment(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.SEG_PARSESEG); log(LOG_LEVEL_VERBOSE, "-------"); header = new SegmentHeader(this); header.unpack(in); @@ -381,6 +408,7 @@ bcBands.unpack(in); fileBands = new FileBands(this); fileBands.unpack(in); + Profiler.markStop(Profiler.SEG_PARSESEG); } /** @@ -394,10 +422,12 @@ */ public void unpack(InputStream in, JarOutputStream out) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.SEG_UNPACK); if (!in.markSupported()) in = new BufferedInputStream(in); parseSegment(in); writeJar(out); + Profiler.markStop(Profiler.SEG_UNPACK); } /** @@ -416,6 +446,7 @@ */ public void writeJar(JarOutputStream out) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.SEG_WRITEJAR); fileBands.processFileBits(); BufferedOutputStream buffer = new BufferedOutputStream(out); DataOutputStream dos = new DataOutputStream(buffer); @@ -459,14 +490,17 @@ dos.flush(); classNum++; } else { + Profiler.markStart(Profiler.SEG_WRITEPRIM); long size = fileSize[i]; entry.setSize(size); // TODO pull from in byte[] data = fileBits[i]; out.write(data); + Profiler.markStop(Profiler.SEG_WRITEPRIM); } } dos.flush(); + Profiler.markStop(Profiler.SEG_WRITEJAR); } public SegmentConstantPool getConstantPool() { @@ -526,4 +560,9 @@ this.deflateHint = deflateHint; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_SEGMENT); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/IcBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/IcBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/IcBands.java (working copy) @@ -24,6 +24,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.ClassConstantPool; @@ -53,6 +54,8 @@ * @see org.apache.harmony.unpack200.BandSet#unpack(java.io.InputStream) */ public void unpack(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.ICBANDS_UNPACK); + // Read IC bands int innerClassCount = header.getInnerClassCount(); int[] icThisClassInts = decodeBandInt("ic_this_class", in, @@ -102,6 +105,7 @@ } icAll[i] = new IcTuple(icTupleC, icTupleF, icTupleC2, icTupleN, cIndex, c2Index, nIndex); } + Profiler.markStop(Profiler.ICBANDS_UNPACK); } public IcTuple[] getIcTuples() { @@ -204,5 +208,10 @@ } return orderedRelevantTuples; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ICBANDS); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/IcTuple.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/IcTuple.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/IcTuple.java (working copy) @@ -18,6 +18,8 @@ import java.util.ArrayList; +import org.apache.harmony.pack200.profiler.Profiler; + /** * An IcTuple is the set of information that describes an inner class. * @@ -304,6 +306,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ICTUPLE); return 17 + C.hashCode() + C2.hashCode() + N.hashCode(); } Index: src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/SegmentConstantPool.java (working copy) @@ -19,6 +19,7 @@ import java.util.List; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.ClassFileEntry; import org.apache.harmony.unpack200.bytecode.ConstantPoolEntry; @@ -314,4 +315,9 @@ throw new Error("Get value incomplete"); } } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_SEGCP); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/CpBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/CpBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/CpBands.java (working copy) @@ -23,6 +23,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.CPDouble; import org.apache.harmony.unpack200.bytecode.CPFieldRef; @@ -99,6 +100,8 @@ } public void unpack(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.CPBANDS_UNPACK); + parseCpUtf8(in); parseCpInt(in); parseCpFloat(in); @@ -123,6 +126,8 @@ fieldOffset = descrOffset + cpDescriptor.length; methodOffset = fieldOffset + cpFieldClass.length; imethodOffset = methodOffset + cpMethodClass.length; + + Profiler.markStop(Profiler.CPBANDS_UNPACK); } /** @@ -760,5 +765,10 @@ public int[] getCpDescriptorTypeInts() { return cpDescriptorTypeInts; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_CPBANDS); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/SegmentHeader.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/SegmentHeader.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/SegmentHeader.java (working copy) @@ -24,6 +24,7 @@ import org.apache.harmony.pack200.BHSDCodec; import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * SegmentHeader is the header band of a {@link Segment} @@ -96,6 +97,7 @@ public void unpack(InputStream in) throws IOException, Pack200Exception, Error, Pack200Exception { + Profiler.markStart(Profiler.SEGHEADER_UNPACK); long word[] = decodeScalar("archive_magic_word", in, Codec.BYTE1, magic.length); for (int m = 0; m < magic.length; m++) @@ -117,6 +119,7 @@ readFully(in, bandHeaders); setBandHeadersData(bandHeaders); } + Profiler.markStop(Profiler.SEGHEADER_UNPACK); } /** @@ -433,4 +436,9 @@ public int getBandHeadersSize() { return bandHeadersSize; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_SEGHEADER); + return System.identityHashCode(this); + } } Index: src/main/java/org/apache/harmony/unpack200/ClassBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/ClassBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/ClassBands.java (working copy) @@ -24,6 +24,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.CPNameAndType; @@ -134,6 +135,7 @@ * @see org.apache.harmony.unpack200.BandSet#unpack(java.io.InputStream) */ public void unpack(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.CBANDS_UNPACK); int classCount = header.getClassCount(); classThisInts = decodeBandInt("class_this", in, Codec.DELTA5, classCount); classThis = getReferences(classThisInts, cpBands.getCpClass()); @@ -147,11 +149,23 @@ classCount); classMethodCount = decodeBandInt("class_method_count", in, Codec.DELTA5, classCount); + Profiler.markStart(Profiler.CBANDS_UNPACK_FIELDS); parseFieldBands(in); + Profiler.markStop(Profiler.CBANDS_UNPACK_FIELDS); + + Profiler.markStart(Profiler.CBANDS_UNPACK_METHODS); parseMethodBands(in); + Profiler.markStop(Profiler.CBANDS_UNPACK_METHODS); + + Profiler.markStart(Profiler.CBANDS_UNPACK_CLASSATTR); parseClassAttrBands(in); + Profiler.markStop(Profiler.CBANDS_UNPACK_CLASSATTR); + + Profiler.markStart(Profiler.CBANDS_UNPACK_CODE); parseCodeBands(in); - + Profiler.markStop(Profiler.CBANDS_UNPACK_CODE); + + Profiler.markStop(Profiler.CBANDS_UNPACK); } private void parseFieldBands(InputStream in) throws IOException, @@ -1397,4 +1411,9 @@ return icLocal; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_CLASSBANDS); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/SegmentOptions.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/SegmentOptions.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/SegmentOptions.java (working copy) @@ -17,6 +17,7 @@ package org.apache.harmony.unpack200; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Stores the combinations of bit flags that can be used in the segment header @@ -123,4 +124,9 @@ public boolean shouldDeflate() { return (options & DEFLATE_HINT) != 0; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_SEGOPTS); + return System.identityHashCode(this); + } } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPMethodRef.java (working copy) @@ -16,6 +16,8 @@ */ package org.apache.harmony.unpack200.bytecode; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Method reference constant pool entry. */ @@ -29,4 +31,10 @@ return new ClassFileEntry[] { className, nameAndType }; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPMETHREF); + return System.identityHashCode(this); + } + + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationDefaultAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * AnnotationDefault class file attribute */ @@ -54,4 +56,8 @@ return this == obj; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_ANNDEFARG); + return System.identityHashCode(this); + } } Index: src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/Attribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Abstract superclass for class file attributes */ @@ -97,7 +99,8 @@ return false; } - public int hashCode() { + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_ATTR); final int PRIME = 31; int result = 1; result = PRIME * result Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPFieldRef.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Field reference constant pool entry. */ @@ -55,6 +57,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPFIELDREF); final int PRIME = 31; int result = 1; result = PRIME * result Index: src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionsAttribute.java (working copy) @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.Arrays; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Exceptions class file attribute */ @@ -76,6 +78,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_EXCPATTR); final int prime = 31; int result = super.hashCode(); result = prime * result + ExceptionsAttribute.hashCode(exceptions); Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPField.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPField.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPField.java (working copy) @@ -18,6 +18,8 @@ import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Field constant pool entry. */ @@ -31,4 +33,10 @@ return "Field: " + name + "(" + descriptor + ")"; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPFIELD); + return System.identityHashCode(this); + } + + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ClassConstantPool.java (working copy) @@ -25,6 +25,7 @@ import java.util.Map; import java.util.TreeSet; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.Segment; /** @@ -279,4 +280,10 @@ } return entry; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CCP); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPUTF8.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * UTF8 constant pool entry, used for storing long Strings. */ @@ -58,6 +60,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPUTF8); final int PRIME = 31; return PRIME + utf8.hashCode(); } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPConstant.java (working copy) @@ -16,6 +16,8 @@ */ package org.apache.harmony.unpack200.bytecode; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Abstract superclass for constant pool constant entries such as numbers or * Strings @@ -57,6 +59,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPCONSTANT); final int PRIME = 31; int result = 1; result = PRIME * result + ((value == null) ? 0 : value.hashCode()); Index: src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/NewAttribute.java (working copy) @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * A compressor-defined class file attribute. */ @@ -252,4 +254,9 @@ } } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_NEWATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPInteger.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Integer constant pool entry. */ @@ -35,5 +37,11 @@ public String toString() { return "Integer: " + getValue(); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPINTEGER); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/OperandManager.java (working copy) @@ -17,6 +17,7 @@ package org.apache.harmony.unpack200.bytecode; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.Segment; import org.apache.harmony.unpack200.SegmentConstantPool; @@ -239,4 +240,10 @@ return newClass; } } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_OPMGR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/SourceFileAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Source file class file attribute */ @@ -68,6 +70,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_SRCFILEATTR); final int PRIME = 31; int result = super.hashCode(); result = PRIME * result + ((name == null) ? 0 : name.hashCode()); Index: src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/DeprecatedAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Deprecated class file attribute. */ @@ -61,4 +63,10 @@ return this == obj; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_DEPRATTR); + return System.identityHashCode(this); + } + + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/SignatureAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Signature class file attribute */ @@ -76,4 +78,10 @@ public boolean equals(Object obj) { return this == obj; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_SIGNATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPFloat.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Float constant pool entry. */ @@ -35,5 +37,11 @@ public String toString() { return "Float: " + getValue(); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPFLOAT); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPClass.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Constant pool entry for a class */ @@ -62,6 +64,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPCLASS); return utf8.hashCode(); } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPString.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * String constant pool entry. */ @@ -53,4 +55,10 @@ protected ClassFileEntry[] getNestedClassFileEntries() { return new ClassFileEntry[] { name }; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPSTRING); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPMember.java (working copy) @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Superclass for member constant pool entries, such as fields or methods. */ @@ -77,6 +79,8 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPMEMBER); + final int PRIME = 31; int result = 1; result = PRIME * result + attributes.hashCode(); Index: src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/BCIRenumberedAttribute.java (working copy) @@ -21,6 +21,7 @@ import java.util.List; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Abstract superclass for attributes that have some part encoded with a BCI @@ -73,5 +74,10 @@ .intValue(); } } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_RA); + return System.identityHashCode(this); + } } Index: src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTableAttribute.java (working copy) @@ -22,6 +22,7 @@ import java.util.List; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Local variable table @@ -165,4 +166,10 @@ public boolean equals(Object obj) { return this == obj; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_LOCVARATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/LineNumberTableAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Line number table */ @@ -85,4 +87,10 @@ protected int[] getStartPCs() { return start_pcs; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_LINENUMATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ByteCode.java (working copy) @@ -19,6 +19,7 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.Segment; import org.apache.harmony.unpack200.bytecode.forms.ByteCodeForm; @@ -105,6 +106,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_BC); final int prime = 41; int result = 1; result = prime * result + getName().hashCode() + getByteCodeForm().hashCode(); Index: src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CodeAttribute.java (working copy) @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.Segment; public class CodeAttribute extends BCIRenumberedAttribute { @@ -195,4 +196,10 @@ entry.renumber(byteCodeOffsets); } } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CODEATTR); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPRef.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Abstract superclass for reference constant pool entries, such as a method or * field reference. @@ -75,6 +77,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPREF); final int PRIME = 37; return (PRIME * className.hashCode()) + nameAndType.hashCode(); } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPMethod.java (working copy) @@ -18,6 +18,8 @@ import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Method constant pool entry. */ @@ -31,4 +33,9 @@ return "Method: " + name + "(" + descriptor + ")"; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPMETHOD); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/ClassFile.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ClassFile.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ClassFile.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * ClassFile is used to represent and write out Java class files. */ @@ -37,10 +39,13 @@ public Attribute[] attributes; public void write(DataOutputStream dos) throws IOException { + Profiler.markStart(Profiler.CLASSF_WRITE); dos.writeInt(magic); dos.writeShort(minor); dos.writeShort(major); dos.writeShort(pool.size() + 1); + + Profiler.markStart(Profiler.CLASSF_WRITE_CP); for (int i = 1; i <= pool.size(); i++) { ConstantPoolEntry entry; (entry = (ConstantPoolEntry) pool.get(i)).doWrite(dos); @@ -50,24 +55,48 @@ || entry.getTag() == ConstantPoolEntry.CP_Long) i++; } + Profiler.markStop(Profiler.CLASSF_WRITE_CP); + dos.writeShort(accessFlags); dos.writeShort(thisClass); dos.writeShort(superClass); + + Profiler.markStart(Profiler.CLASSF_WRITE_INTF); dos.writeShort(interfaces.length); for (int i = 0; i < interfaces.length; i++) { dos.writeShort(interfaces[i]); } + Profiler.markStop(Profiler.CLASSF_WRITE_INTF); + + Profiler.markStart(Profiler.CLASSF_WRITE_FIELDS); dos.writeShort(fields.length); for (int i = 0; i < fields.length; i++) { fields[i].write(dos); } + Profiler.markStop(Profiler.CLASSF_WRITE_FIELDS); + + Profiler.markStart(Profiler.CLASSF_WRITE_METHODS); dos.writeShort(methods.length); for (int i = 0; i < methods.length; i++) { methods[i].write(dos); } + Profiler.markStop(Profiler.CLASSF_WRITE_METHODS); + + Profiler.markStart(Profiler.CLASSF_WRITE_ATTR); dos.writeShort(attributes.length); for (int i = 0; i < attributes.length; i++) { attributes[i].write(dos); } + Profiler.markStop(Profiler.CLASSF_WRITE_ATTR); + + Profiler.markStop(Profiler.CLASSF_WRITE); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CF); + return System.identityHashCode(this); + } + + + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/EnclosingMethodAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Enclosing method class file attribute. */ @@ -88,5 +90,11 @@ public boolean equals(Object obj) { return this == obj; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_ENCMETHATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleAnnotationsAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Annotations class file attribute, either a RuntimeVisibleAnnotations * attribute or a RuntimeInvisibleAnnotations attribute. @@ -66,4 +68,11 @@ public boolean equals(Object obj) { return this == obj; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_RTATTR); + return System.identityHashCode(this); + } + + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ConstantValueAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * An {@link Attribute} representing a constant. */ @@ -64,6 +66,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CVATTR); final int PRIME = 31; int result = super.hashCode(); result = PRIME * result + ((entry == null) ? 0 : entry.hashCode()); Index: src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/RuntimeVisibleorInvisibleParameterAnnotationsAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Paramenter annotations class file attribute, either a * RuntimeVisibleParamenterAnnotations attribute or a @@ -104,4 +106,9 @@ return this == obj; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_RTANNATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/InnerClassesAttribute.java (working copy) @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Inner classes class file attribute */ @@ -127,6 +129,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_INNERCLASSATTR); final int PRIME = 31; int result = super.hashCode(); result = PRIME Index: src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationsAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationsAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/AnnotationsAttribute.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Abstract superclass for Annotations attributes */ @@ -157,4 +159,9 @@ super(attributeName); } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_ANNATTR); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPInterfaceMethodRef.java (working copy) @@ -13,6 +13,8 @@ */ package org.apache.harmony.unpack200.bytecode; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Interface method reference constant pool entry. */ @@ -32,4 +34,10 @@ public int invokeInterfaceCount() { return nameAndType.invokeInterfaceCount(); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPIFMETHREF); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPLong.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Long constant pool entry. */ @@ -36,4 +38,10 @@ return "Long: " + getValue(); } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPLONG); + return System.identityHashCode(this); + } + + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/ExceptionTableEntry.java (working copy) @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; + /** * An entry in an exception table. */ @@ -93,4 +95,10 @@ catchType.resolve(pool); catchTypeIndex = pool.indexOf(catchType); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_EXCPTABLENTRY); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPNameAndType.java (working copy) @@ -19,6 +19,7 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.SegmentUtils; /** @@ -77,6 +78,7 @@ } public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPNAMETYPE); final int PRIME = 31; int result = 1; result = PRIME * result + descriptor.hashCode(); Index: src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/CPDouble.java (working copy) @@ -19,6 +19,8 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.harmony.pack200.profiler.Profiler; + /** * Double constant pool entry. */ @@ -35,5 +37,11 @@ public String toString() { return "Double: " + getValue(); } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_CPDOUBLE); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/bytecode/LocalVariableTypeTableAttribute.java (working copy) @@ -22,6 +22,7 @@ import java.util.List; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Local variable type table. @@ -165,5 +166,11 @@ public boolean equals(Object obj) { return this == obj; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BC_LOCVARTABLE); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/BandSet.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/BandSet.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/BandSet.java (working copy) @@ -26,6 +26,7 @@ import org.apache.harmony.pack200.CodecEncoding; import org.apache.harmony.pack200.Pack200Exception; import org.apache.harmony.pack200.PopulationCodec; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.CPDouble; import org.apache.harmony.unpack200.bytecode.CPFieldRef; @@ -636,4 +637,9 @@ return result; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BANDSET); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/Archive.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/Archive.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/Archive.java (working copy) @@ -30,6 +30,7 @@ import java.util.zip.GZIPInputStream; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Archive is the main entry point to unpack200. An archive is constructed with @@ -96,6 +97,8 @@ * @throws IOException */ public void unpack() throws Pack200Exception, IOException { + Profiler.markStart(Profiler.UNPACK); + outputStream.setComment("PACK200"); try { if (!inputStream.markSupported()) { @@ -190,6 +193,9 @@ throw new Pack200Exception("Failed to delete the input file."); } } + + Profiler.markStop(Profiler.UNPACK); + Profiler.printStats(); } private boolean available(InputStream inputStream) throws IOException { @@ -234,4 +240,9 @@ this.deflateHint = deflateHint; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ARCHIVE); + return System.identityHashCode(this); + } + } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/MetadataBandGroup.java (working copy) @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.List; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.AnnotationDefaultAttribute; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.CPDouble; @@ -245,4 +246,8 @@ return boxed; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_METABANDGROUP); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/NewAttributeBands.java (working copy) @@ -26,6 +26,7 @@ import org.apache.harmony.pack200.BHSDCodec; import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.CPClass; import org.apache.harmony.unpack200.bytecode.CPDouble; @@ -954,4 +955,8 @@ } } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_NEWATTRBANDS); + return System.identityHashCode(this); + } } \ No newline at end of file Index: src/main/java/org/apache/harmony/unpack200/FileBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/FileBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/FileBands.java (working copy) @@ -21,6 +21,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Parses the file band headers (not including the actual bits themselves). At @@ -59,6 +60,7 @@ * @see org.apache.harmony.unpack200.BandSet#unpack(java.io.InputStream) */ public void unpack(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.FBANDS_UNPACK); int numberOfFiles = header.getNumberOfFiles(); SegmentOptions options = header.getOptions(); @@ -80,10 +82,12 @@ } this.in = in; // store for use by processFileBits(), which is called // later + + Profiler.markStop(Profiler.FBANDS_UNPACK); } // TODO: stream the file bits directly somehow - public void processFileBits() throws IOException, Pack200Exception { + public void processFileBits() throws IOException, Pack200Exception { // now read in the bytes int numberOfFiles = header.getNumberOfFiles(); fileBits = new byte[numberOfFiles][]; @@ -97,7 +101,7 @@ throw new Pack200Exception("Expected to read " + size + " bytes but read " + read); } - } + } } public byte[][] getFileBits() { @@ -120,4 +124,9 @@ return fileSize; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_FILEBANDS); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/AttrDefinitionBands.java (working copy) @@ -21,6 +21,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; /** * Attribute definition bands are the set of bands used to define extra @@ -49,6 +50,8 @@ * @see org.apache.harmony.unpack200.BandSet#unpack(java.io.InputStream) */ public void unpack(InputStream in) throws IOException, Pack200Exception { + Profiler.markStart(Profiler.ADB_UNPACK); + int attributeDefinitionCount = header.getAttributeDefinitionCount(); attributeDefinitionHeader = decodeBandInt("attr_definition_headers", in, Codec.BYTE1, attributeDefinitionCount); @@ -76,10 +79,17 @@ attributeDefinitionMap.add(layout, newBands); } attributeDefinitionMap.checkMap(); + + Profiler.markStop(Profiler.ADB_UNPACK); } public AttributeLayoutMap getAttributeDefinitionMap() { return attributeDefinitionMap; } + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_ATTRDEF); + return System.identityHashCode(this); + } + } Index: src/main/java/org/apache/harmony/unpack200/BcBands.java =================================================================== --- src/main/java/org/apache/harmony/unpack200/BcBands.java (revision 675615) +++ src/main/java/org/apache/harmony/unpack200/BcBands.java (working copy) @@ -25,6 +25,7 @@ import org.apache.harmony.pack200.Codec; import org.apache.harmony.pack200.Pack200Exception; +import org.apache.harmony.pack200.profiler.Profiler; import org.apache.harmony.unpack200.bytecode.Attribute; import org.apache.harmony.unpack200.bytecode.BCIRenumberedAttribute; import org.apache.harmony.unpack200.bytecode.ByteCode; @@ -83,7 +84,7 @@ * @see org.apache.harmony.unpack200.BandSet#unpack(java.io.InputStream) */ public void unpack(InputStream in) throws IOException, Pack200Exception { - + Profiler.markStart(Profiler.BCBANDS_UNPACK); AttributeLayoutMap attributeDefinitionMap = segment .getAttrDefinitionBands().getAttributeDefinitionMap(); int classCount = header.getClassCount(); @@ -116,6 +117,7 @@ int bcEscCount = 0; int bcEscRefCount = 0; + Profiler.markStart(Profiler.BCBANDS_UNPACK_ATTRLAYOUT); AttributeLayout abstractModifier = attributeDefinitionMap .getAttributeLayout(AttributeLayout.ACC_ABSTRACT, AttributeLayout.CONTEXT_METHOD); @@ -125,6 +127,8 @@ AttributeLayout staticModifier = attributeDefinitionMap .getAttributeLayout(AttributeLayout.ACC_STATIC, AttributeLayout.CONTEXT_METHOD); + Profiler.markStop(Profiler.BCBANDS_UNPACK_ATTRLAYOUT); + methodByteCodePacked = new byte[classCount][][]; int bcParsed = 0; @@ -137,16 +141,24 @@ long methodFlag = methodFlags[c][m]; if (!abstractModifier.matches(methodFlag) && !nativeModifier.matches(methodFlag)) { + + Profiler.markStart(Profiler.BCBANDS_UNPACK_PARSE1); ByteArrayOutputStream codeBytes = new ByteArrayOutputStream(); byte code; while ((code = (byte) (0xff & in.read())) != -1) codeBytes.write(code); methodByteCodePacked[c][m] = codeBytes.toByteArray(); bcParsed += methodByteCodePacked[c][m].length; + Profiler.markStop(Profiler.BCBANDS_UNPACK_PARSE1); + + Profiler.markStart(Profiler.BCBANDS_UNPACK_PARSE2); int[] codes = new int[methodByteCodePacked[c][m].length]; for (int i = 0; i < codes.length; i++) { codes[i] = methodByteCodePacked[c][m][i] & 0xff; } + Profiler.markStop(Profiler.BCBANDS_UNPACK_PARSE2); + + Profiler.markStart(Profiler.BCBANDS_UNPACK_SELECT); for (int i = 0; i < methodByteCodePacked[c][m].length; i++) { int codePacked = 0xff & methodByteCodePacked[c][m][i]; switch (codePacked) { @@ -299,6 +311,7 @@ } } } + Profiler.markStop(Profiler.BCBANDS_UNPACK_SELECT); } } } @@ -388,6 +401,7 @@ int[][] handlerClassTypes = segment.getClassBands() .getCodeHandlerClassRCN(); + Profiler.markStart(Profiler.BCBANDS_UNPACK_METHODS); for (int c = 0; c < classCount; c++) { int numberOfMethods = methodFlags[c].length; for (int m = 0; m < numberOfMethods; m++) { @@ -457,6 +471,8 @@ } } } + Profiler.markStop(Profiler.BCBANDS_UNPACK_METHODS); + Profiler.markStop(Profiler.BCBANDS_UNPACK); } private boolean startsWithIf(int codePacked) { @@ -571,5 +587,10 @@ public int[][] getBcEscByte() { return bcEscByte; } + + public int hashCode() { + Profiler.markPoint(Profiler.HASHCODE_BCBANDS); + return System.identityHashCode(this); + } }