< prev index next >

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

Print this page

        

*** 61,70 **** --- 61,73 ---- SupportedGC(UseConcMarkSweepGC, CollectedHeap::CMS, cmsArguments, "cmsgc" ), SupportedGC(UseG1GC, CollectedHeap::G1, g1Arguments, "g1gc" ), #endif // INCLUDE_ALL_GCS }; + #define FOR_EACH_SUPPORTED_GC(var) \ + for (const SupportedGC* var = &SupportedGCs[0]; var < &SupportedGCs[ARRAY_SIZE(SupportedGCs)]; var++) + GCArguments* GCConfig::_arguments = NULL; bool GCConfig::_gc_selected_ergonomically = false; void GCConfig::select_gc_ergonomically() { #if INCLUDE_ALL_GCS
*** 81,107 **** FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); #endif // INCLUDE_ALL_GCS } bool GCConfig::is_no_gc_selected() { ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._flag) { return false; } } return true; } bool GCConfig::is_exactly_one_gc_selected() { CollectedHeap::Name selected = CollectedHeap::None; ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._flag) { ! if (SupportedGCs[i]._name == selected || selected == CollectedHeap::None) { // Selected ! selected = SupportedGCs[i]._name; } else { // More than one selected return false; } } --- 84,110 ---- FLAG_SET_ERGO_IF_DEFAULT(bool, UseSerialGC, true); #endif // INCLUDE_ALL_GCS } bool GCConfig::is_no_gc_selected() { ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_flag) { return false; } } return true; } bool GCConfig::is_exactly_one_gc_selected() { CollectedHeap::Name selected = CollectedHeap::None; ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_flag) { ! if (gc->_name == selected || selected == CollectedHeap::None) { // Selected ! selected = gc->_name; } else { // More than one selected return false; } }
*** 125,137 **** _gc_selected_ergonomically = true; } if (is_exactly_one_gc_selected()) { // Exacly one GC selected ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._flag) { ! return &SupportedGCs[i]._arguments; } } } // More than one GC selected --- 128,140 ---- _gc_selected_ergonomically = true; } if (is_exactly_one_gc_selected()) { // Exacly one GC selected ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_flag) { ! return &gc->_arguments; } } } // More than one GC selected
*** 144,167 **** assert(_arguments == NULL, "Already initialized"); _arguments = select_gc(); } bool GCConfig::is_gc_supported(CollectedHeap::Name name) { ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._name == name) { // Supported return true; } } // Not supported return false; } bool GCConfig::is_gc_selected(CollectedHeap::Name name) { ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._name == name && SupportedGCs[i]._flag) { // Selected return true; } } --- 147,170 ---- assert(_arguments == NULL, "Already initialized"); _arguments = select_gc(); } bool GCConfig::is_gc_supported(CollectedHeap::Name name) { ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_name == name) { // Supported return true; } } // Not supported return false; } bool GCConfig::is_gc_selected(CollectedHeap::Name name) { ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_name == name && gc->_flag) { // Selected return true; } }
*** 174,186 **** } const char* GCConfig::hs_err_name() { if (is_exactly_one_gc_selected()) { // Exacly one GC selected ! for (size_t i = 0; i < ARRAY_SIZE(SupportedGCs); i++) { ! if (SupportedGCs[i]._flag) { ! return SupportedGCs[i]._hs_err_name; } } } // Zero or more than one GC selected --- 177,189 ---- } const char* GCConfig::hs_err_name() { if (is_exactly_one_gc_selected()) { // Exacly one GC selected ! FOR_EACH_SUPPORTED_GC(gc) { ! if (gc->_flag) { ! return gc->_hs_err_name; } } } // Zero or more than one GC selected
< prev index next >