RFR: 8269685: Optimize HeapHprofBinWriter implementation [v4]

Lin Zang lzang at openjdk.java.net
Mon Aug 23 23:55:27 UTC 2021


On Mon, 23 Aug 2021 23:26:14 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> 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 {
> }

Hi Serguei (@sspitsyn),

   So sorry that I missed your comments, it is strange that your review didn't show on github in this PR.
   I make these methods empty in AbstractHeapGraphWriter rather than abstract so that there is no need to add these empty code in HeapGXLWriter, which is a subclass of AbstractHeapGraphWriter.  I think this may help make the code change clean. 
   What do you think?

BRs,
Lin

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

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


More information about the serviceability-dev mailing list