With the Root List, it should be fairly easy to support Archived Heap for SerialGC and ParallelGC:. See JDK-8234679 - Support CDS shared heap in non-G1 garbage collectors.
- At VM bootstrap, reserve enough space in the old generation
- Copy objects in the Open Region and Closed Region into the old generation
- Relocation may be necessary, since the Open/Closed regions assume that they are mapped to a pre-determined address, which may be different than the location of the old generation
- There's already code for doing this kind of relocation (see HeapShared::patch_archived_heap_embedded_pointers)
- The Open/Closed regions may be divided into at most 4 blocks with gaps in between. The easiest way to handle the gaps is to fill them with a dummy array.
- Even with the copying/patching, the start up time should still be much faster than running without the Archived Heap. Without the Archived Heap, we need to create many expensive data structures (such as the module graph) from scratch, which is very time consuming.
- G1 with Archived Heap = 32ms
- G1 without Archived Heap = 57ms
- Copying/patching = less than 1ms.
Support Uncompressed Oops for the Archived Heap
In JDK 15, the class metadata references archived heap objects using narrowOop (e.g. Klass::_archived_mirror). With the Root List, these references are changed to be integer indices. As a result, most of the Archive Heap code should be agnostic to oop encoding. This will make it easier to support uncompressed oops in Archive Heap.