changeset 59796:86a603d04e54

8247560: Shenandoah: heap iteration holds root locks all the time Reviewed-by: zgu
author shade
date Mon, 15 Jun 2020 14:11:43 +0200
parents d17230bf917e
children dba78a53ca7d
files src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Sun Jun 14 18:16:31 2020 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Mon Jun 15 14:11:43 2020 +0200
@@ -1297,11 +1297,16 @@
 
   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);
 
-  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.
   while (! oop_stack.is_empty()) {