RFR: 8273508: Support archived heap objects in SerialGC

Thomas Schatzl tschatzl at openjdk.java.net
Tue Sep 21 08:20:52 UTC 2021


On Tue, 21 Sep 2021 06:11:58 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> When `-XX:+UseSerialGC is enabled`, load the CDS archived heap objects into `SerialHeap::old_gen()` during VM bootstrap. This improves VM start-up time, mostly because the module graph can be loaded from the archive.
> 
> 
> $ perf stat -r 40 java -XX:+UseSerialGC -version
> 
> Before: 0.042484507 seconds time elapsed ( +- 0.72% )
> After:  0.031671000 seconds time elapsed ( +- 0.72% )
> 
> 
> Changes in the gc subdirectories are contributed by @tschatzl

Initial pass over GC code.

src/hotspot/share/gc/serial/serialHeap.cpp line 32:

> 30: #include "gc/shared/strongRootsScope.hpp"
> 31: #include "gc/shared/suspendibleThreadSet.hpp"
> 32: #include "logging/log.hpp"

Suggestion:


Debug code.

src/hotspot/share/gc/serial/serialHeap.cpp line 121:

> 119:   MutexLocker ml(Heap_lock);
> 120:   HeapWord* result = old_gen()->allocate(word_size, /* is_tlab = */ false);
> 121:   return result;

Suggestion:

  return old_gen()->allocate(word_size, false /* is_tlab */);

Tighten the code...; GC code (see similar examples in the file) also adds the comment for bool parameters after that parameter.

src/hotspot/share/gc/serial/tenuredGeneration.cpp line 225:

> 223:   TenuredSpace* space = (TenuredSpace*)_the_space;
> 224: 
> 225:   space->initialize_threshold();

Suggestion:

  // Create the BOT for the archive space.
  TenuredSpace* space = (TenuredSpace*)_the_space;
  space->initialize_threshold();

src/hotspot/share/gc/serial/tenuredGeneration.cpp line 228:

> 226:   HeapWord* start = archive_space.start();
> 227:   while (start < archive_space.end()) {
> 228:     size_t word_size = _the_space->block_size(start); /// Crashes here when accessing the klass

Please remove the debug comment :)
Suggestion:

    size_t word_size = _the_space->block_size(start);

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

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


More information about the hotspot-dev mailing list