RFR: 8338912: CDS: Segmented roots array [v5]

Aleksey Shipilev shade at openjdk.org
Tue Sep 10 08:36:08 UTC 2024


On Tue, 10 Sep 2024 08:27:15 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> > Whoa, that looks fragile! It feels safer to memset(0) the entire header then? Whack-a-mole-ing the alignment paddings every time we add a field is not convenient.
> 
> Testing `memset` here, but would probably integrate it separately as [JDK-8339830](https://bugs.openjdk.org/browse/JDK-8339830).

Hm, maybe I am misunderstanding this. I see there is the initialization here:


  _header = (FileMapHeader*)os::malloc(header_size, mtInternal);
  memset((void*)_header, 0, header_size);
  _header->populate(this,


...and here we read the header in its entirety:


  _header = (FileMapHeader*)os::malloc(gen_header->_header_size, mtInternal);
  os::lseek(fd, 0, SEEK_SET); // reset to begin of the archive
  size_t size = gen_header->_header_size;
  size_t n = ::read(fd, (void*)_header, (unsigned int)size);


I'll look around map files to understand it better.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20858#issuecomment-2340017184


More information about the hotspot-runtime-dev mailing list