RFR: 8273152: Refactor CDS FileMapHeader loading code [v5]

Yumin Qi minqi at openjdk.java.net
Wed Oct 6 16:41:10 UTC 2021

On Wed, 6 Oct 2021 04:09:32 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
>>   Added a helper class to facilitate checking archive
> src/hotspot/share/cds/filemap.cpp line 1099:
>> 1097:     lseek(_fd, _header->_base_archive_path_offset, SEEK_SET); // position to correct offset.
>> 1098:     size_t n = os::read(_fd, *target, (unsigned int)name_size);
>> 1099:     if (n != name_size) {
> I think there's no need to do another read. The base name string is already inside the buffer that was read on line 1079. You can just do a `strncpy` into `*target`

FileHeaderHelper only read sizeof(GenericCDSFileMapHeader) which is the stable information for reading other information and checking the archive. It does not include name in the buffer.


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

More information about the hotspot-runtime-dev mailing list