113 } |
113 } |
114 |
114 |
115 void VM_GC_HeapInspection::doit() { |
115 void VM_GC_HeapInspection::doit() { |
116 HandleMark hm; |
116 HandleMark hm; |
117 CollectedHeap* ch = Universe::heap(); |
117 CollectedHeap* ch = Universe::heap(); |
|
118 ch->ensure_parsability(false); // must happen, even if collection does |
|
119 // not happen (e.g. due to GC_locker) |
118 if (_full_gc) { |
120 if (_full_gc) { |
119 ch->collect_as_vm_thread(GCCause::_heap_inspection); |
121 // The collection attempt below would be skipped anyway if |
120 } else { |
122 // the gc locker is held. The following dump may then be a tad |
121 // make the heap parsable (no need to retire TLABs) |
123 // misleading to someone expecting only live objects to show |
122 ch->ensure_parsability(false); |
124 // up in the dump (see CR 6944195). Just issue a suitable warning |
|
125 // in that case and do not attempt to do a collection. |
|
126 // The latter is a subtle point, because even a failed attempt |
|
127 // to GC will, in fact, induce one in the future, which we |
|
128 // probably want to avoid in this case because the GC that we may |
|
129 // be about to attempt holds value for us only |
|
130 // if it happens now and not if it happens in the eventual |
|
131 // future. |
|
132 if (GC_locker::is_active()) { |
|
133 warning("GC locker is held; pre-dump GC was skipped"); |
|
134 } else { |
|
135 ch->collect_as_vm_thread(GCCause::_heap_inspection); |
|
136 } |
123 } |
137 } |
124 HeapInspection::heap_inspection(_out, _need_prologue /* need_prologue */); |
138 HeapInspection::heap_inspection(_out, _need_prologue /* need_prologue */); |
125 } |
139 } |
126 |
140 |
127 |
141 |