--- old/src/hotspot/share/gc/g1/g1Arguments.cpp 2018-02-20 23:17:40.108597043 +0100 +++ new/src/hotspot/share/gc/g1/g1Arguments.cpp 2018-02-20 23:17:39.916590481 +0100 @@ -25,14 +25,42 @@ #include "precompiled.hpp" #include "gc/g1/g1Arguments.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/heapRegion.hpp" +#include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/gcArguments.inline.hpp" #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" #include "runtime/vm_version.hpp" +G1Settings G1Arguments::initialize_heap_flags() { + G1Settings s; + + GCArguments::initialize_heap_flags(s); + + // Set up the region size and associated fields. Given that the + // policy is created before the heap, we have to set this up here, + // so it's done as soon as possible. + + // It would have been natural to pass initial_heap_byte_size() and + // max_heap_byte_size() to setup_heap_region_size() but those have + // not been set up at this point since they should be aligned with + // the region size. So, there is a circular dependency here. We base + // the region size on the heap size, but the heap size should be + // aligned with the region size. To get around this we use the + // unaligned values for the heap. + + assert(InitialHeapSize == s._initial_heap_byte_size, "Sanity"); + assert(MaxHeapSize == s._max_heap_byte_size, "Sanity"); + + HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize); + HeapRegionRemSet::setup_remset_size(); + + GCArguments::initialize_size_info(s); + + return s; +} + size_t G1Arguments::conservative_max_heap_alignment() { return HeapRegion::max_region_size(); } @@ -109,5 +137,5 @@ } CollectedHeap* G1Arguments::create_heap() { - return create_heap_with_policy(); + return new G1CollectedHeap(initialize_heap_flags()); }