< prev index next >

src/share/vm/gc_implementation/g1/satbQueue.cpp

Print this page
rev 10535 : [backport] SATB buffer filtering/compaction hides unmarked objects until final-mark
rev 10548 : [backport] Forceful SATB buffer flushes should be time-periodic, not traffic-dependent

@@ -175,10 +175,26 @@
   size_t sz = _sz;
   size_t all_entries = sz / oopSize;
   size_t retained_entries = (sz - _index) / oopSize;
   size_t perc = retained_entries * 100 / all_entries;
   bool should_enqueue = perc > (size_t) G1SATBBufferEnqueueingThresholdPercent;
+
+  if (UseShenandoahGC) {
+    Thread* t = Thread::current();
+    if (t->is_force_satb_flush()) {
+      if (!should_enqueue && sz != _index) {
+        // Non-empty buffer is compacted, and we decided not to enqueue it.
+        // Shenandoah still wants to know about leftover work in that buffer eventually.
+        // This avoid dealing with these leftovers during the final-mark, after the buffers
+        // are drained completely.
+        // TODO: This can be extended to handle G1 too
+        should_enqueue = true;
+      }
+      t->set_force_satb_flush(false);
+    }
+  }
+
   return should_enqueue;
 }
 
 void ObjPtrQueue::apply_closure_and_empty(SATBBufferClosure* cl) {
   assert(SafepointSynchronize::is_at_safepoint(),
< prev index next >