RFR: 8338011: CDS archived heap object support for 64-bit Windows

Thomas Stuefe stuefe at openjdk.org
Sat Aug 10 17:01:39 UTC 2024


On Thu, 8 Aug 2024 19:16:20 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> We didn't support CDS archived heap object on Windows because
> 
> - The Windows implementation of `os::map_memory()` cannot map the contents of a file into a region that's already reserved by the garbage collector.
> - We had a high failure rate for mapping the CDS archive on Windows due to ASLR, sometimes as high as 50%. So it didn't seem worth the effort (mainly testing) to support archived heap objects on Windows.
> 
> Both of the above issues were fixed in [JDK-8231610](https://bugs.openjdk.org/browse/JDK-8231610), so we should add the support to Windows now.
> 
> (Tested on Oracle CI tiers 1-7)

This looks good to me. Mostly questions from my side.

src/hotspot/share/cds/filemap.cpp line 2181:

> 2179:   // for mapped region as it is part of the reserved java heap, which is already recorded.
> 2180:   char* addr = (char*)_mapped_heap_memregion.start();
> 2181:   char* base = map_memory(_fd, _full_path, r->file_offset(),

So, do I understand this correctly, this always failed on Windows, since we attempt to map into the reserved region of the already existing Java heap?

src/hotspot/share/cds/filemap.cpp line 2188:

> 2186:                      /* do_commit = */ true)) {
> 2187:       dealloc_heap_region();
> 2188:       log_error(cds)("Failed to read archived heap region at " INTPTR_FORMAT, p2i(addr));

Very minor bikeshedding, we don't try to read the heap region at this address but load it into memory at that address. Up to you if you change anything.

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

Marked as reviewed by stuefe (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20514#pullrequestreview-2231475971
PR Review Comment: https://git.openjdk.org/jdk/pull/20514#discussion_r1712672522
PR Review Comment: https://git.openjdk.org/jdk/pull/20514#discussion_r1712672803


More information about the hotspot-dev mailing list