Skip to content

Commit 969708b

Browse files
committed
8356157: Remove retry loop in collect of SerialHeap and ParallelScavengeHeap
Reviewed-by: tschatzl, zgu
1 parent 9927ec0 commit 969708b

2 files changed

Lines changed: 7 additions & 33 deletions

File tree

src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -502,21 +502,8 @@ void ParallelScavengeHeap::collect(GCCause::Cause cause) {
502502
full_gc_count = total_full_collections();
503503
}
504504

505-
while (true) {
506-
VM_ParallelGCCollect op(gc_count, full_gc_count, cause);
507-
VMThread::execute(&op);
508-
509-
if (!GCCause::is_explicit_full_gc(cause)) {
510-
return;
511-
}
512-
513-
{
514-
MutexLocker ml(Heap_lock);
515-
if (full_gc_count != total_full_collections()) {
516-
return;
517-
}
518-
}
519-
}
505+
VM_ParallelGCCollect op(gc_count, full_gc_count, cause);
506+
VMThread::execute(&op);
520507
}
521508

522509
bool ParallelScavengeHeap::must_clear_all_soft_refs() {

src/hotspot/share/gc/serial/serialHeap.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -607,24 +607,11 @@ void SerialHeap::collect(GCCause::Cause cause) {
607607
bool should_run_young_gc = (cause == GCCause::_wb_young_gc)
608608
DEBUG_ONLY(|| (cause == GCCause::_scavenge_alot));
609609

610-
while (true) {
611-
VM_SerialGCCollect op(!should_run_young_gc,
612-
gc_count_before,
613-
full_gc_count_before,
614-
cause);
615-
VMThread::execute(&op);
616-
if (!GCCause::is_explicit_full_gc(cause)) {
617-
return;
618-
}
619-
620-
{
621-
MutexLocker ml(Heap_lock);
622-
// Read the GC count while holding the Heap_lock
623-
if (full_gc_count_before != total_full_collections()) {
624-
return;
625-
}
626-
}
627-
}
610+
VM_SerialGCCollect op(!should_run_young_gc,
611+
gc_count_before,
612+
full_gc_count_before,
613+
cause);
614+
VMThread::execute(&op);
628615
}
629616

630617
void SerialHeap::do_full_collection(bool clear_all_soft_refs) {

0 commit comments

Comments
 (0)