RFR: 8269685: Optimize HeapHprofBinWriter implementation [v8]
Serguei Spitsyn
sspitsyn at openjdk.java.net
Thu Sep 16 15:47:50 UTC 2021
On Thu, 16 Sep 2021 12:26:10 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 pull request now contains ten commits:
>
> - Merge branch 'master' into hprof
> - code clean up and refinement
> - Merge branch 'master' into hprof
> - make calculateGlobalJNIHandlesDumpRecordSize abstract
> - code clean up and remove useless methods
> - Merge branch 'master' into hprof
> - fix write size issue
> - Merge branch 'master' into hprof
> - 8269685: Optimize HeapHprofBinWriter implementation
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java line 495:
> 493: Klass bottomType = oak.getBottomKlass();
> 494: if (bottomType instanceof InstanceKlass ||
> 495: bottomType instanceof TypeArrayKlass) {
Formatting nit: I'd suggest to align `bottomType` with `bottomType`.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java line 611:
> 609: Klass reflectedKlass = java_lang_Class.asKlass(instance);
> 610: // dump instance record only for primitive type Class objects.
> 611: // all other Class objects are covered by writeClassDumpRecords.
Formatting nit for 610-611: If the comment is ended with dot then start it from capital a letter.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java line 642:
> 640: @Override
> 641: protected void writeHeapRecordPrologue(int size) throws IOException {
> 642: if (size == 0 || (currentSegmentStart > 0)) {
Formatting nit: There is no need in internal brackets `()` around `currentSegmentStart > 0`.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java line 721:
> 719:
> 720: // Check if we need to truncate an array.
> 721: // The limitation is that the size of "heap dump" or "heap dump segment" must be <= MAX_U4_VALUE
Formatting nit: Add dot at the end of comment.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4666
More information about the serviceability-dev
mailing list