Skip to content

Commit 305c3e3

Browse files
rmacnak-googleCommit Bot
authored and
Commit Bot
committed
[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: #47492 Change-Id: I2538f9e9b6d67bbbca0951d5162075a950658380 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246180 Reviewed-by: Siva Annamalai <[email protected]> Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent d427700 commit 305c3e3

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

runtime/vm/heap/heap.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,12 @@ void Heap::CheckConcurrentMarking(Thread* thread, GCReason reason) {
565565

566566
switch (phase) {
567567
case PageSpace::kMarking:
568-
// TODO(rmacnak): Have this thread help with marking.
568+
// TODO(rmacnak): Make the allocator of a large page mark size equals to
569+
// the large page?
570+
COMPILE_ASSERT(kOldPageSize == 512 * KB);
571+
COMPILE_ASSERT(kNewPageSize == 512 * KB);
572+
old_space_.IncrementalMarkWithSizeBudget(512 * KB);
573+
return;
569574
case PageSpace::kSweepingLarge:
570575
case PageSpace::kSweepingRegular:
571576
return; // Busy.

runtime/vm/heap/pages.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,19 +1674,17 @@ void PageSpaceController::RecordUpdate(SpaceUsage before,
16741674
after.CombinedUsedInWords() + (kOldPageSizeInWords * growth_in_pages);
16751675

16761676
#if defined(TARGET_ARCH_IA32)
1677-
// No concurrent marking.
1678-
soft_gc_threshold_in_words_ = threshold;
1679-
hard_gc_threshold_in_words_ = threshold;
1677+
bool concurrent_mark = false;
16801678
#else
1681-
// Start concurrent marking when old-space has less than half of new-space
1682-
// available or less than 5% available.
1683-
// Note that heap_ can be null in some unit tests.
1684-
const intptr_t new_space =
1685-
heap_ == nullptr ? 0 : heap_->new_space()->CapacityInWords();
1686-
const intptr_t headroom = Utils::Maximum(new_space / 2, threshold / 20);
1687-
soft_gc_threshold_in_words_ = threshold;
1688-
hard_gc_threshold_in_words_ = threshold + headroom;
1679+
bool concurrent_mark = FLAG_concurrent_mark && (FLAG_marker_tasks != 0);
16891680
#endif
1681+
if (concurrent_mark) {
1682+
soft_gc_threshold_in_words_ = threshold;
1683+
hard_gc_threshold_in_words_ = kIntptrMax / kWordSize;
1684+
} else {
1685+
soft_gc_threshold_in_words_ = kIntptrMax / kWordSize;
1686+
hard_gc_threshold_in_words_ = threshold;
1687+
}
16901688

16911689
// Set a tight idle threshold.
16921690
idle_gc_threshold_in_words_ =

0 commit comments

Comments
 (0)