changeset 1391:6ecb6e6de3d6

Merge
author kevinw
date Mon, 19 Apr 2010 05:40:21 -0700
parents 79e419e5ea3b (current diff) bdb5361c461c (diff)
children 1316cec51b4d
files
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Fri Apr 16 08:48:16 2010 -0700
+++ b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Mon Apr 19 05:40:21 2010 -0700
@@ -115,11 +115,25 @@
 void VM_GC_HeapInspection::doit() {
   HandleMark hm;
   CollectedHeap* ch = Universe::heap();
+  ch->ensure_parsability(false); // must happen, even if collection does
+                                 // not happen (e.g. due to GC_locker)
   if (_full_gc) {
-    ch->collect_as_vm_thread(GCCause::_heap_inspection);
-  } else {
-    // make the heap parsable (no need to retire TLABs)
-    ch->ensure_parsability(false);
+    // The collection attempt below would be skipped anyway if
+    // the gc locker is held. The following dump may then be a tad
+    // misleading to someone expecting only live objects to show
+    // up in the dump (see CR 6944195). Just issue a suitable warning
+    // in that case and do not attempt to do a collection.
+    // The latter is a subtle point, because even a failed attempt
+    // to GC will, in fact, induce one in the future, which we
+    // probably want to avoid in this case because the GC that we may
+    // be about to attempt holds value for us only
+    // if it happens now and not if it happens in the eventual
+    // future.
+    if (GC_locker::is_active()) {
+      warning("GC locker is held; pre-dump GC was skipped");
+    } else {
+      ch->collect_as_vm_thread(GCCause::_heap_inspection);
+    }
   }
   HeapInspection::heap_inspection(_out, _need_prologue /* need_prologue */);
 }