< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp

Print this page

  7  * This code is free software; you can redistribute it and/or modify it
  8  * under the terms of the GNU General Public License version 2 only, as
  9  * published by the Free Software Foundation.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  *
 25  */
 26 
 27 #include "gc/shared/fullGCForwarding.hpp"
 28 #include "gc/shared/gcArguments.hpp"
 29 #include "gc/shared/tlab_globals.hpp"
 30 #include "gc/shared/workerPolicy.hpp"
 31 #include "gc/shenandoah/shenandoahArguments.hpp"
 32 #include "gc/shenandoah/shenandoahCardTable.hpp"
 33 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
 34 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
 35 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 36 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 37 #include "runtime/globals_extension.hpp"
 38 #include "runtime/java.hpp"
 39 #include "utilities/defaultStream.hpp"
 40 #include "utilities/powerOfTwo.hpp"
 41 
 42 void ShenandoahArguments::initialize() {
 43 #if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
 44   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
 45 #endif
 46 
 47 #if 0 // leave this block as stepping stone for future platforms

184   // historical data, assigning more recent data the weight according to TLABAllocationWeight.
185   // Current default is good for generational collectors that run frequent young GCs.
186   // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
187   // to converge faster over smaller number of resizing decisions.
188   if (strcmp(ShenandoahGCMode, "generational") && FLAG_IS_DEFAULT(TLABAllocationWeight)) {
189     FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
190   }
191   // In generational mode, let TLABAllocationWeight keeps its default value of 35.
192 
193   if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
194     vm_exit_during_initialization(
195       err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
196   }
197 
198   // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
199   if ((strcmp(ShenandoahGCMode, "generational") == 0)
200       && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
201     log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
202       " supports adaptive heuristics", ShenandoahGCHeuristics);
203   }
204 
205   FullGCForwarding::initialize_flags(MaxHeapSize);
206 }
207 
208 size_t ShenandoahArguments::conservative_max_heap_alignment() {
209   size_t align = next_power_of_2(ShenandoahMaxRegionSize);
210   if (UseLargePages) {
211     align = MAX2(align, os::large_page_size());
212   }
213   return align;
214 }
215 
216 void ShenandoahArguments::initialize_alignments() {
217   CardTable::initialize_card_size();
218 
219   // Need to setup sizes early to get correct alignments.
220   MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
221 
222   // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
223   size_t align = ShenandoahHeapRegion::region_size_bytes();
224   if (UseLargePages) {
225     align = MAX2(align, os::large_page_size());

  7  * This code is free software; you can redistribute it and/or modify it
  8  * under the terms of the GNU General Public License version 2 only, as
  9  * published by the Free Software Foundation.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  *
 25  */
 26 

 27 #include "gc/shared/gcArguments.hpp"
 28 #include "gc/shared/tlab_globals.hpp"
 29 #include "gc/shared/workerPolicy.hpp"
 30 #include "gc/shenandoah/shenandoahArguments.hpp"
 31 #include "gc/shenandoah/shenandoahCardTable.hpp"
 32 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
 33 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
 34 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 35 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
 36 #include "runtime/globals_extension.hpp"
 37 #include "runtime/java.hpp"
 38 #include "utilities/defaultStream.hpp"
 39 #include "utilities/powerOfTwo.hpp"
 40 
 41 void ShenandoahArguments::initialize() {
 42 #if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
 43   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
 44 #endif
 45 
 46 #if 0 // leave this block as stepping stone for future platforms

183   // historical data, assigning more recent data the weight according to TLABAllocationWeight.
184   // Current default is good for generational collectors that run frequent young GCs.
185   // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
186   // to converge faster over smaller number of resizing decisions.
187   if (strcmp(ShenandoahGCMode, "generational") && FLAG_IS_DEFAULT(TLABAllocationWeight)) {
188     FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
189   }
190   // In generational mode, let TLABAllocationWeight keeps its default value of 35.
191 
192   if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
193     vm_exit_during_initialization(
194       err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
195   }
196 
197   // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
198   if ((strcmp(ShenandoahGCMode, "generational") == 0)
199       && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
200     log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
201       " supports adaptive heuristics", ShenandoahGCHeuristics);
202   }


203 }
204 
205 size_t ShenandoahArguments::conservative_max_heap_alignment() {
206   size_t align = next_power_of_2(ShenandoahMaxRegionSize);
207   if (UseLargePages) {
208     align = MAX2(align, os::large_page_size());
209   }
210   return align;
211 }
212 
213 void ShenandoahArguments::initialize_alignments() {
214   CardTable::initialize_card_size();
215 
216   // Need to setup sizes early to get correct alignments.
217   MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
218 
219   // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
220   size_t align = ShenandoahHeapRegion::region_size_bytes();
221   if (UseLargePages) {
222     align = MAX2(align, os::large_page_size());
< prev index next >