RFR: 8269685: Optimize HeapHprofBinWriter implementation [v4]

Serguei Spitsyn sspitsyn at openjdk.java.net
Mon Aug 23 23:29:34 UTC 2021


On Fri, 13 Aug 2021 10:46:02 GMT, Lin Zang <lzang at openjdk.org> wrote:

>> This PR rewrite the implementation of the HeapHprofBinWriter, which could simplify the logic of current implementation.
>> please see detail description at https://bugs.openjdk.java.net/browse/JDK-8269685.
>
> Lin Zang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into hprof
>  - fix write size issue
>  - Merge branch 'master' into hprof
>  - 8269685: Optimize HeapHprofBinWriter implementation

Hi Lin,

You did not answer my question about empty methods in the AbstractHeapGraphWriter.java.
It seems the following methods have to be abstract instead of being empty:

+    protected int calculateGlobalJNIHandlesDumpRecordSize() {
+        return 0;
+    }
+
+    protected int calculateJavaThreadsDumpRecordSize() {
+        return 0;
+    }
+
+    protected int calculateOopDumpRecordSize(Oop oop) throws IOException {
+        return 0;
+    }
. . . 
    // object field writers
protected void writeReferenceField(Oop oop, OopField field)
     throws IOException {
}
protected void writeByteField(Oop oop, ByteField field)
    throws IOException {
}
protected void writeCharField(Oop oop, CharField field)
    throws IOException {
}
protected void writeBooleanField(Oop oop, BooleanField field)
    throws IOException {
}
protected void writeShortField(Oop oop, ShortField field)
    throws IOException {
}
protected void writeIntField(Oop oop, IntField field)
    throws IOException {
}
protected void writeLongField(Oop oop, LongField field)
    throws IOException {
}
protected void writeFloatField(Oop oop, FloatField field)
    throws IOException {
}
protected void writeDoubleField(Oop oop, DoubleField field)
    throws IOException {
}
protected void writeObjectFooter(Oop oop) throws IOException {
}
protected void writeHeapFooter() throws IOException {
}
protected void writeHeapRecordPrologue() throws IOException {
} 
+    protected void writeHeapRecordPrologue(int size) throws IOException {
+    }
+
protected void writeHeapRecordEpilogue() throws IOException {
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/4666


More information about the serviceability-dev mailing list