8247560: Shenandoah: heap iteration holds root locks all the time

Reviewed-by: zgu
This commit is contained in:
Aleksey Shipilev 2020-06-15 14:11:43 +02:00
parent 7a7859a465
commit 9db6fb74df

View File

@ -1283,11 +1283,16 @@ void ShenandoahHeap::object_iterate(ObjectClosure* cl) {
Stack<oop,mtGC> oop_stack; Stack<oop,mtGC> oop_stack;
// First, we process GC roots according to current GC cycle. This populates the work stack with initial objects.
ShenandoahHeapIterationRootScanner rp;
ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack); ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
rp.roots_do(&oops); {
// First, we process GC roots according to current GC cycle.
// This populates the work stack with initial objects.
// It is important to relinquish the associated locks before diving
// into heap dumper.
ShenandoahHeapIterationRootScanner rp;
rp.roots_do(&oops);
}
// Work through the oop stack to traverse heap. // Work through the oop stack to traverse heap.
while (! oop_stack.is_empty()) { while (! oop_stack.is_empty()) {