--- old/src/hotspot/share/gc/shared/gcArguments.cpp 2018-11-19 14:08:36.098591800 -0800 +++ new/src/hotspot/share/gc/shared/gcArguments.cpp 2018-11-19 14:08:35.034190400 -0800 @@ -28,6 +28,7 @@ #include "runtime/arguments.hpp" #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" +#include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" void GCArguments::initialize() { @@ -54,3 +55,18 @@ FLAG_SET_CMDLINE(bool, ClassUnloadingWithConcurrentMark, false); } } + +bool GCArguments::check_args_consistency() { + bool status = true; + if (!FLAG_IS_DEFAULT(AllocateHeapAt) && !FLAG_IS_DEFAULT(AllocateOldGenAt)) { + jio_fprintf(defaultStream::error_stream(), + "AllocateHeapAt and AllocateOldGenAt cannot be used together.\n"); + status = false; + } + if (!FLAG_IS_DEFAULT(AllocateOldGenAt) && (UseSerialGC || UseConcMarkSweepGC || UseEpsilonGC || UseZGC)) { + jio_fprintf(defaultStream::error_stream(), + "AllocateOldGenAt not supported for selected GC.\n"); + status = false; + } + return status; +}