[vm, gc] Remove the growth policy's hard limit when concurrent marking is available.
Instead, impose back-pressure by making mutators assist with marking as they allocate. Synchronous marking may still occur if the heap grows to --old_gen_heap_size or the OS is out of memory. TEST=ci Bug: https://github.com/dart-lang/sdk/issues/47492 Change-Id: I2538f9e9b6d67bbbca0951d5162075a950658380 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246180 Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
@@ -565,7 +565,12 @@ void Heap::CheckConcurrentMarking(Thread* thread, GCReason reason) {
|
||||
|
||||
switch (phase) {
|
||||
case PageSpace::kMarking:
|
||||
// TODO(rmacnak): Have this thread help with marking.
|
||||
// TODO(rmacnak): Make the allocator of a large page mark size equals to
|
||||
// the large page?
|
||||
COMPILE_ASSERT(kOldPageSize == 512 * KB);
|
||||
COMPILE_ASSERT(kNewPageSize == 512 * KB);
|
||||
old_space_.IncrementalMarkWithSizeBudget(512 * KB);
|
||||
return;
|
||||
case PageSpace::kSweepingLarge:
|
||||
case PageSpace::kSweepingRegular:
|
||||
return; // Busy.
|
||||
|
||||
@@ -1674,19 +1674,17 @@ void PageSpaceController::RecordUpdate(SpaceUsage before,
|
||||
after.CombinedUsedInWords() + (kOldPageSizeInWords * growth_in_pages);
|
||||
|
||||
#if defined(TARGET_ARCH_IA32)
|
||||
// No concurrent marking.
|
||||
soft_gc_threshold_in_words_ = threshold;
|
||||
hard_gc_threshold_in_words_ = threshold;
|
||||
bool concurrent_mark = false;
|
||||
#else
|
||||
// Start concurrent marking when old-space has less than half of new-space
|
||||
// available or less than 5% available.
|
||||
// Note that heap_ can be null in some unit tests.
|
||||
const intptr_t new_space =
|
||||
heap_ == nullptr ? 0 : heap_->new_space()->CapacityInWords();
|
||||
const intptr_t headroom = Utils::Maximum(new_space / 2, threshold / 20);
|
||||
soft_gc_threshold_in_words_ = threshold;
|
||||
hard_gc_threshold_in_words_ = threshold + headroom;
|
||||
bool concurrent_mark = FLAG_concurrent_mark && (FLAG_marker_tasks != 0);
|
||||
#endif
|
||||
if (concurrent_mark) {
|
||||
soft_gc_threshold_in_words_ = threshold;
|
||||
hard_gc_threshold_in_words_ = kIntptrMax / kWordSize;
|
||||
} else {
|
||||
soft_gc_threshold_in_words_ = kIntptrMax / kWordSize;
|
||||
hard_gc_threshold_in_words_ = threshold;
|
||||
}
|
||||
|
||||
// Set a tight idle threshold.
|
||||
idle_gc_threshold_in_words_ =
|
||||
|
||||
Reference in New Issue
Block a user