src/hotspot/share/gc/g1/g1CollectedHeap.cpp
changeset 48105 8d15b1369c7a
parent 47885 5caa1d5f74c1
child 48106 1a3ac5e7cfb8
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Nov 22 14:31:48 2017 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Nov 22 17:54:50 2017 -0800
@@ -81,6 +81,7 @@
 #include "runtime/atomic.hpp"
 #include "runtime/init.hpp"
 #include "runtime/orderAccess.inline.hpp"
+#include "runtime/threadSMR.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/align.hpp"
 #include "utilities/globalDefinitions.hpp"
@@ -2653,11 +2654,9 @@
 
 size_t G1CollectedHeap::pending_card_num() {
   size_t extra_cards = 0;
-  JavaThread *curr = Threads::first();
-  while (curr != NULL) {
+  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *curr = jtiwh.next(); ) {
     DirtyCardQueue& dcq = curr->dirty_card_queue();
     extra_cards += dcq.size();
-    curr = curr->next();
   }
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
   size_t buffer_size = dcqs.buffer_size();