diff -r 7397b5b2d3b2 -r cde4a65ba47d src/hotspot/share/memory/universe.cpp --- a/src/hotspot/share/memory/universe.cpp Thu Nov 16 17:10:21 2017 +0100 +++ b/src/hotspot/share/memory/universe.cpp Thu Nov 16 12:53:29 2017 +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