On Fri, 13 Aug 2021 10:46:02 GMT, Lin Zang <lz...@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