--- old/src/hotspot/share/memory/universe.cpp 2017-11-14 12:30:44.369447500 +0100 +++ new/src/hotspot/share/memory/universe.cpp 2017-11-14 12:30:43.912452629 +0100 @@ -32,9 +32,9 @@ #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" #include "code/dependencies.hpp" -#include "gc/serial/serialHeap.hpp" #include "gc/shared/cardTableModRefBS.hpp" #include "gc/shared/collectedHeap.inline.hpp" +#include "gc/shared/gcArguments.hpp" #include "gc/shared/gcLocker.inline.hpp" #include "gc/shared/generation.hpp" #include "gc/shared/gcTraceTime.inline.hpp" @@ -82,14 +82,6 @@ #include "utilities/macros.hpp" #include "utilities/ostream.hpp" #include "utilities/preserveException.hpp" -#if INCLUDE_ALL_GCS -#include "gc/cms/cmsCollectorPolicy.hpp" -#include "gc/cms/cmsHeap.hpp" -#include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" -#include "gc/parallel/parallelScavengeHeap.hpp" -#include "gc/shared/adaptiveSizePolicy.hpp" -#endif // INCLUDE_ALL_GCS #if INCLUDE_CDS #include "classfile/sharedClassUtil.hpp" #endif @@ -746,27 +738,8 @@ CollectedHeap* Universe::create_heap() { assert(_collectedHeap == NULL, "Heap already created"); -#if !INCLUDE_ALL_GCS - if (UseParallelGC) { - fatal("UseParallelGC not supported in this VM."); - } else if (UseG1GC) { - fatal("UseG1GC not supported in this VM."); - } else if (UseConcMarkSweepGC) { - fatal("UseConcMarkSweepGC not supported in this VM."); -#else - if (UseParallelGC) { - return Universe::create_heap_with_policy(); - } else if (UseG1GC) { - return Universe::create_heap_with_policy(); - } else if (UseConcMarkSweepGC) { - return Universe::create_heap_with_policy(); -#endif - } else if (UseSerialGC) { - return Universe::create_heap_with_policy(); - } - - ShouldNotReachHere(); - return NULL; + assert(GCArguments::is_initialized(), "GC must be initialized here"); + return GCArguments::arguments()->create_heap(); } // Choose the heap base address and oop encoding mode