RFR: 8269685: Optimize HeapHprofBinWriter implementation [v4]
Lin Zang
lzang at openjdk.java.net
Tue Aug 24 06:39:36 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
Dear Serguei,
> Lin, in order to see my inlined comment you need to look at "Files changed".
I can not find your comments here either, would you like to help check whether you sumbited the inlined commit after review?
> I still miss something. If these methods have to be empty then what is the purpose to have them?
The main reason is that both `HeapHprofBinWriter` and `HeapGXLWriter` are extended from `AbstractHeapGraphWriter`, and they both invoke method `write()` in `AbstractHeapGraphWriter` for heap iteration which invoke `doObj()`. And in method `doObj()`, it calls `writeHeapRecordPrologue(calculateOopDumpRecordSize())` which should do nothing for `HeapGXLWriter` and do some work for `HeapHprofBinWriter`. So I made empty method `writeHeapRecordPrologue(int)` and `calculateOopDumpRecordSize()` in base class and have them implemented in `HeapHprofBinWriter` only.
> Also, a couple of new empty methods are not used, so the question is why do you add them:
> calculateGlobalJNIHandlesDumpRecordSize, calculateJavaThreadsDumpRecordSize
Thanks for point them out, I will remove these not used methods.
BRs,
Lin
-------------
PR: https://git.openjdk.java.net/jdk/pull/4666
More information about the serviceability-dev
mailing list