< prev index next >

src/hotspot/share/gc/shared/gcConfig.cpp

Print this page




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/serial/serialArguments.hpp"
  27 #include "gc/shared/gcConfig.hpp"
  28 #include "runtime/java.hpp"
  29 #include "runtime/os.hpp"
  30 #include "utilities/macros.hpp"
  31 #if INCLUDE_ALL_GCS
  32 #include "gc/parallel/parallelArguments.hpp"
  33 #include "gc/cms/cmsArguments.hpp"
  34 #include "gc/g1/g1Arguments.hpp"

  35 #endif // INCLUDE_ALL_GCS
  36 
  37 struct SupportedGC {
  38   bool&               _flag;
  39   CollectedHeap::Name _name;
  40   GCArguments&        _arguments;
  41 
  42   SupportedGC(bool& flag, CollectedHeap::Name name, GCArguments& arguments) :
  43       _flag(flag), _name(name), _arguments(arguments) {}
  44 };
  45 
  46 static SerialArguments   serialArguments;
  47 #if INCLUDE_ALL_GCS
  48 static ParallelArguments parallelArguments;
  49 static CMSArguments      cmsArguments;
  50 static G1Arguments       g1Arguments;

  51 #endif // INCLUDE_ALL_GCS
  52 
  53 // Table of supported GCs, for translating between command
  54 // line flag, CollectedHeap::Name and GCArguments instance.
  55 static const SupportedGC SupportedGCs[] = {
  56   SupportedGC(UseSerialGC,        CollectedHeap::Serial,   serialArguments),
  57 #if INCLUDE_ALL_GCS
  58   SupportedGC(UseParallelGC,      CollectedHeap::Parallel, parallelArguments),
  59   SupportedGC(UseParallelOldGC,   CollectedHeap::Parallel, parallelArguments),
  60   SupportedGC(UseConcMarkSweepGC, CollectedHeap::CMS,      cmsArguments),
  61   SupportedGC(UseG1GC,            CollectedHeap::G1,       g1Arguments),

  62 #endif // INCLUDE_ALL_GCS
  63 };
  64 
  65 GCArguments* GCConfig::_arguments = NULL;
  66 bool GCConfig::_gc_selected_ergonomically = false;
  67 
  68 void GCConfig::select_gc_ergonomically() {
  69 #if INCLUDE_ALL_GCS
  70   if (os::is_server_class_machine()) {
  71     FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
  72   } else {
  73     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
  74   }
  75 #else
  76   UNSUPPORTED_OPTION(UseG1GC);
  77   UNSUPPORTED_OPTION(UseParallelGC);
  78   UNSUPPORTED_OPTION(UseParallelOldGC);
  79   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
  80   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
  81 #endif // INCLUDE_ALL_GCS




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/serial/serialArguments.hpp"
  27 #include "gc/shared/gcConfig.hpp"
  28 #include "runtime/java.hpp"
  29 #include "runtime/os.hpp"
  30 #include "utilities/macros.hpp"
  31 #if INCLUDE_ALL_GCS
  32 #include "gc/parallel/parallelArguments.hpp"
  33 #include "gc/cms/cmsArguments.hpp"
  34 #include "gc/g1/g1Arguments.hpp"
  35 #include "gc/epsilon/epsilonArguments.hpp"
  36 #endif // INCLUDE_ALL_GCS
  37 
  38 struct SupportedGC {
  39   bool&               _flag;
  40   CollectedHeap::Name _name;
  41   GCArguments&        _arguments;
  42 
  43   SupportedGC(bool& flag, CollectedHeap::Name name, GCArguments& arguments) :
  44       _flag(flag), _name(name), _arguments(arguments) {}
  45 };
  46 
  47 static SerialArguments   serialArguments;
  48 #if INCLUDE_ALL_GCS
  49 static ParallelArguments parallelArguments;
  50 static CMSArguments      cmsArguments;
  51 static G1Arguments       g1Arguments;
  52 static EpsilonArguments  epsilonArguments;
  53 #endif // INCLUDE_ALL_GCS
  54 
  55 // Table of supported GCs, for translating between command
  56 // line flag, CollectedHeap::Name and GCArguments instance.
  57 static const SupportedGC SupportedGCs[] = {
  58   SupportedGC(UseSerialGC,        CollectedHeap::Serial,   serialArguments),
  59 #if INCLUDE_ALL_GCS
  60   SupportedGC(UseParallelGC,      CollectedHeap::Parallel, parallelArguments),
  61   SupportedGC(UseParallelOldGC,   CollectedHeap::Parallel, parallelArguments),
  62   SupportedGC(UseConcMarkSweepGC, CollectedHeap::CMS,      cmsArguments),
  63   SupportedGC(UseG1GC,            CollectedHeap::G1,       g1Arguments),
  64   SupportedGC(UseEpsilonGC,       CollectedHeap::Epsilon,  epsilonArguments),
  65 #endif // INCLUDE_ALL_GCS
  66 };
  67 
  68 GCArguments* GCConfig::_arguments = NULL;
  69 bool GCConfig::_gc_selected_ergonomically = false;
  70 
  71 void GCConfig::select_gc_ergonomically() {
  72 #if INCLUDE_ALL_GCS
  73   if (os::is_server_class_machine()) {
  74     FLAG_SET_ERGO_IF_DEFAULT(bool, UseG1GC, true);
  75   } else {
  76     FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
  77   }
  78 #else
  79   UNSUPPORTED_OPTION(UseG1GC);
  80   UNSUPPORTED_OPTION(UseParallelGC);
  81   UNSUPPORTED_OPTION(UseParallelOldGC);
  82   UNSUPPORTED_OPTION(UseConcMarkSweepGC);
  83   FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true);
  84 #endif // INCLUDE_ALL_GCS


< prev index next >