< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 53865 : imported patch njt_iterate
rev 53868 : imported patch remove_shared_satb_lock

@@ -1674,12 +1674,11 @@
 
   G1BarrierSet::satb_mark_queue_set().initialize(this,
                                                  SATB_Q_CBL_mon,
                                                  &bs->satb_mark_queue_buffer_allocator(),
                                                  G1SATBProcessCompletedThreshold,
-                                                 G1SATBBufferEnqueueingThresholdPercent,
-                                                 Shared_SATB_Q_lock);
+                                                 G1SATBBufferEnqueueingThresholdPercent);
 
   // process_completed_buffers_threshold and max_completed_buffers are updated
   // later, based on the concurrent refinement object.
   G1BarrierSet::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
                                                   &bs->dirty_card_queue_buffer_allocator(),

@@ -2602,20 +2601,24 @@
     CGC_lock->notify();
   }
 }
 
 size_t G1CollectedHeap::pending_card_num() {
-  size_t extra_cards = 0;
-  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *curr = jtiwh.next(); ) {
-    G1DirtyCardQueue& dcq = G1ThreadLocalData::dirty_card_queue(curr);
-    extra_cards += dcq.size();
+  struct CountCardsClosure : public ThreadClosure {
+    size_t _cards;
+    CountCardsClosure() : _cards(0) {}
+    virtual void do_thread(Thread* t) {
+      _cards += G1ThreadLocalData::dirty_card_queue(t).size();
   }
+  } count_from_threads;
+  Threads::threads_do(&count_from_threads);
+
   G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   size_t buffer_size = dcqs.buffer_size();
   size_t buffer_num = dcqs.completed_buffers_num();
 
-  return buffer_size * buffer_num + extra_cards;
+  return buffer_size * buffer_num + count_from_threads._cards;
 }
 
 bool G1CollectedHeap::is_potential_eager_reclaim_candidate(HeapRegion* r) const {
   // We don't nominate objects with many remembered set entries, on
   // the assumption that such objects are likely still live.
< prev index next >