diff src/share/vm/runtime/thread.cpp @ 8016:1135141fb97e

Merge
author brutisso
date Fri, 08 Feb 2013 10:08:40 +0100
parents 3c9bc17b9403 06fd03af6ce4
children b8d5d7a6c94c
line wrap: on
line diff
--- a/src/share/vm/runtime/thread.cpp	Thu Feb 07 20:40:14 2013 -0500
+++ b/src/share/vm/runtime/thread.cpp	Fri Feb 08 10:08:40 2013 +0100
@@ -1501,7 +1501,7 @@
   } else {
     _jni_attach_state = _not_attaching_via_jni;
   }
-  assert(_deferred_card_mark.is_empty(), "Default MemRegion ctor");
+  assert(deferred_card_mark().is_empty(), "Default MemRegion ctor");
   _safepoint_visible = false;
 }
 
@@ -1897,9 +1897,16 @@
     JvmtiExport::cleanup_thread(this);
   }
 
+  // We must flush any deferred card marks before removing a thread from
+  // the list of active threads.
+  Universe::heap()->flush_deferred_store_barrier(this);
+  assert(deferred_card_mark().is_empty(), "Should have been flushed");
+
 #if INCLUDE_ALL_GCS
-  // We must flush G1-related buffers before removing a thread from
-  // the list of active threads.
+  // We must flush the G1-related buffers before removing a thread
+  // from the list of active threads. We must do this after any deferred
+  // card marks have been flushed (above) so that any entries that are
+  // added to the thread's dirty card queue as a result are not lost.
   if (UseG1GC) {
     flush_barrier_queues();
   }