hotspot/src/share/vm/runtime/thread.cpp
changeset 46732 05423d4b10d2
parent 46702 13ae789b982e
child 46742 24ec8a039c90
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Jul 25 13:28:14 2017 -0400
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Mon Jul 31 12:37:34 2017 -0700
@@ -3392,6 +3392,13 @@
       tc->do_thread(p);
     }
   }
+  // Thread claiming protocol requires us to claim the same interesting
+  // threads on all paths. Notably, Threads::possibly_parallel_threads_do
+  // claims all Java threads *and* the VMThread. To avoid breaking the
+  // claiming protocol, we have to claim VMThread on this path too, even
+  // if we do not apply the closure to the VMThread.
+  VMThread* vmt = VMThread::vm_thread();
+  (void)vmt->claim_oops_do(true, cp);
 }
 
 // The system initialization in the library has three phases.
@@ -4357,6 +4364,10 @@
     assert((thread_parity == _thread_claim_parity),
            "Thread " PTR_FORMAT " has incorrect parity %d != %d", p2i(p), thread_parity, _thread_claim_parity);
   }
+  VMThread* vmt = VMThread::vm_thread();
+  const int thread_parity = vmt->oops_do_parity();
+  assert((thread_parity == _thread_claim_parity),
+         "VMThread " PTR_FORMAT " has incorrect parity %d != %d", p2i(vmt), thread_parity, _thread_claim_parity);
 }
 #endif // ASSERT