diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index d12e59fd31668ab96684c2a6f02903616f985e1f..c6cd6607eb40c5a35a1ae8d1e0e761c78e6f0bf9 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -4118,10 +4118,14 @@ void G1ParEvacuateFollowersClosure::do_void() { while (queues()->steal(pss->queue_num(), pss->hash_seed(), stolen_task)) { assert(pss->verify_task(stolen_task), "sanity"); if (stolen_task.is_narrow()) { - pss->push_on_queue((narrowOop*) stolen_task); + pss->deal_with_reference((narrowOop*) stolen_task); } else { - pss->push_on_queue((oop*) stolen_task); + pss->deal_with_reference((oop*) stolen_task); } + + // We've just processed a reference and we might have made + // available new entries on the queues. So we have to make sure + // we drain the queues as necessary. pss->trim_queue(); } } while (!offer_termination()); diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index c474ce2ea5cc2f01c037aeb418c2e2706c38ba4e..b97d8710a64bb35c48c055f2b82fd05881e3358e 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1772,7 +1772,6 @@ public: } } -private: template void deal_with_reference(T* ref_to_scan) { if (has_partial_array_mask(ref_to_scan)) { _partial_scan_cl->do_oop_nv(ref_to_scan);