< prev index next > src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp
Print this page
/*
* Copyright (c) 2018, 2022, Red Hat, Inc. All rights reserved.
+ * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
#include "precompiled.hpp"
#include "gc/shared/gcArguments.hpp"
#include "gc/shared/tlab_globals.hpp"
#include "gc/shared/workerPolicy.hpp"
#include "gc/shenandoah/shenandoahArguments.hpp"
+ #include "gc/shenandoah/shenandoahCardTable.hpp"
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
+ #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "runtime/globals_extension.hpp"
#include "runtime/java.hpp"
#include "utilities/defaultStream.hpp"
FLAG_SET_DEFAULT(ShenandoahGCHeuristics, "passive");
FLAG_SET_DEFAULT(ShenandoahSATBBarrier, false);
FLAG_SET_DEFAULT(ShenandoahLoadRefBarrier, false);
- FLAG_SET_DEFAULT(ShenandoahIUBarrier, false);
FLAG_SET_DEFAULT(ShenandoahCASBarrier, false);
+ FLAG_SET_DEFAULT(ShenandoahCardBarrier, false);
FLAG_SET_DEFAULT(ShenandoahCloneBarrier, false);
FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers, false);
#endif
if (UseLargePages) {
// storage allocation code NUMA-aware.
if (FLAG_IS_DEFAULT(UseNUMA)) {
FLAG_SET_DEFAULT(UseNUMA, true);
}
+ // We use this as the time period for tracking minimum mutator utilization (MMU).
+ // In generational mode, the MMU is used as a signal to adjust the size of the
+ // young generation.
+ if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) {
+ FLAG_SET_DEFAULT(GCPauseIntervalMillis, 5000);
+ }
+
// Set up default number of concurrent threads. We want to have cycles complete fast
// enough, but we also do not want to steal too much CPU from the concurrently running
// application. Using 1/4 of available threads for concurrent GC seems a good
// compromise here.
bool ergo_conc = FLAG_IS_DEFAULT(ConcGCThreads);
// User settings error, report and ask user to rectify.
vm_exit_during_initialization("Shenandoah expects ConcGCThreads <= ParallelGCThreads, check -XX:ParallelGCThreads, -XX:ConcGCThreads");
}
}
+ // Disable support for dynamic number of GC threads. We do not let the runtime
+ // heuristics to misjudge how many threads we need during the heavy concurrent phase
+ // or a GC pause.
+ if (UseDynamicNumberOfGCThreads) {
+ if (FLAG_IS_CMDLINE(UseDynamicNumberOfGCThreads)) {
+ warning("Shenandoah does not support UseDynamicNumberOfGCThreads, disabling");
+ }
+ FLAG_SET_DEFAULT(UseDynamicNumberOfGCThreads, false);
+ }
+
if (ShenandoahRegionSampling && FLAG_IS_DEFAULT(PerfDataMemorySize)) {
// When sampling is enabled, max out the PerfData memory to get more
// Shenandoah data in, including Matrix.
FLAG_SET_DEFAULT(PerfDataMemorySize, 2048*K);
}
#ifdef ASSERT
// C2 barrier verification is only reliable when all default barriers are enabled
if (ShenandoahVerifyOptoBarriers &&
(!FLAG_IS_DEFAULT(ShenandoahSATBBarrier) ||
!FLAG_IS_DEFAULT(ShenandoahLoadRefBarrier) ||
- !FLAG_IS_DEFAULT(ShenandoahIUBarrier) ||
!FLAG_IS_DEFAULT(ShenandoahCASBarrier) ||
!FLAG_IS_DEFAULT(ShenandoahCloneBarrier)
)) {
warning("Unusual barrier configuration, disabling C2 barrier verification");
FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers, false);
// With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
// to converge faster over smaller number of resizing decisions.
if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
}
+
+ if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
+ vm_exit_during_initialization(
+ err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
+ }
}
size_t ShenandoahArguments::conservative_max_heap_alignment() {
size_t align = ShenandoahMaxRegionSize;
if (UseLargePages) {
}
return align;
}
void ShenandoahArguments::initialize_alignments() {
+ CardTable::initialize_card_size();
+
// Need to setup sizes early to get correct alignments.
MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
// This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
size_t align = ShenandoahHeapRegion::region_size_bytes();
SpaceAlignment = align;
HeapAlignment = align;
}
CollectedHeap* ShenandoahArguments::create_heap() {
- return new ShenandoahHeap(new ShenandoahCollectorPolicy());
+ if (strcmp(ShenandoahGCMode, "generational") != 0) {
+ // Not generational
+ return new ShenandoahHeap(new ShenandoahCollectorPolicy());
+ } else {
+ return new ShenandoahGenerationalHeap(new ShenandoahCollectorPolicy());
+ }
}
< prev index next >