On Wed, 10 Feb 2021 01:53:38 GMT, Yasumasa Suenaga <ysuen...@openjdk.org> wrote:
>> Lin Zang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> refine code in test. > > src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java > line 1504: > >> 1502: segmentBuffer[segmentWritten++] = (byte)(v >>> 8); >> 1503: segmentBuffer[segmentWritten++] = (byte)(v >>> 0); >> 1504: } > > I'm not familiar to hprof format, but I guess we need to write them with big > endian. > Can we use `ByteBuffer::putInt` and `ByteBuffer::order` at here? I guess it > makes ease to maintenance. Hi @YaSuenag, I found there is also similar code in the original implement, in function fillInHeapRecordLength(). ` fos.write((dumpLen >>> 24) & 0xFF);` ` fos.write((dumpLen >>> 16) & 0xFF);` ` fos.write((dumpLen >>> 8) & 0xFF);` ` fos.write((dumpLen >>> 0) & 0xFF);` Do you think it is ok to also change these codes? If my understanding is correct, the fileOutputStream does not have the process of big/little endian. Thanks, Lin ------------- PR: https://git.openjdk.java.net/jdk/pull/1712