Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp @ 1520:bb843ebc7c55
6919638: CMS: ExplicitGCInvokesConcurrent misinteracts with gc locker
Summary: GC-locker induced concurrent full gc should be asynchronous; policy now controlled by a separate flag, which defaults to false.
Reviewed-by: jmasa
author | ysr |
---|---|
date | Mon, 03 May 2010 20:19:05 -0700 |
parents | a61af66fc99e |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1519:7145628c2fa2 | 1520:bb843ebc7c55 |
---|---|
161 | 161 |
162 // VM operation to invoke a concurrent collection of a | 162 // VM operation to invoke a concurrent collection of a |
163 // GenCollectedHeap heap. | 163 // GenCollectedHeap heap. |
164 void VM_GenCollectFullConcurrent::doit() { | 164 void VM_GenCollectFullConcurrent::doit() { |
165 assert(Thread::current()->is_VM_thread(), "Should be VM thread"); | 165 assert(Thread::current()->is_VM_thread(), "Should be VM thread"); |
166 assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected"); | |
166 | 167 |
167 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 168 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
168 if (_gc_count_before == gch->total_collections()) { | 169 if (_gc_count_before == gch->total_collections()) { |
169 // The "full" of do_full_collection call below "forces" | 170 // The "full" of do_full_collection call below "forces" |
170 // a collection; the second arg, 0, below ensures that | 171 // a collection; the second arg, 0, below ensures that |
188 if (gch->total_full_collections() == _full_gc_count_before) { | 189 if (gch->total_full_collections() == _full_gc_count_before) { |
189 // Disable iCMS until the full collection is done. | 190 // Disable iCMS until the full collection is done. |
190 CMSCollector::disable_icms(); | 191 CMSCollector::disable_icms(); |
191 // In case CMS thread was in icms_wait(), wake it up. | 192 // In case CMS thread was in icms_wait(), wake it up. |
192 CMSCollector::start_icms(); | 193 CMSCollector::start_icms(); |
193 // Nudge the CMS thread to start a concurrent collection | 194 // Nudge the CMS thread to start a concurrent collection. |
194 CMSCollector::request_full_gc(_full_gc_count_before); | 195 CMSCollector::request_full_gc(_full_gc_count_before); |
195 } else { | 196 } else { |
196 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done | 197 FullGCCount_lock->notify_all(); // Inform the Java thread its work is done |
197 } | 198 } |
198 } | 199 } |
229 // this will break for very long-running apps when the | 230 // this will break for very long-running apps when the |
230 // count overflows and wraps around. XXX fix me !!! | 231 // count overflows and wraps around. XXX fix me !!! |
231 // e.g. at the rate of 1 full gc per ms, this could | 232 // e.g. at the rate of 1 full gc per ms, this could |
232 // overflow in about 1000 years. | 233 // overflow in about 1000 years. |
233 GenCollectedHeap* gch = GenCollectedHeap::heap(); | 234 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
234 if (gch->total_full_collections_completed() <= _full_gc_count_before) { | 235 if (_gc_cause != GCCause::_gc_locker && |
236 gch->total_full_collections_completed() <= _full_gc_count_before) { | |
237 assert(ExplicitGCInvokesConcurrent, "Error"); | |
235 // Now, wait for witnessing concurrent gc cycle to complete, | 238 // Now, wait for witnessing concurrent gc cycle to complete, |
236 // but do so in native mode, because we want to lock the | 239 // but do so in native mode, because we want to lock the |
237 // FullGCEvent_lock, which may be needed by the VM thread | 240 // FullGCEvent_lock, which may be needed by the VM thread |
238 // or by the CMS thread, so we do not want to be suspended | 241 // or by the CMS thread, so we do not want to be suspended |
239 // while holding that lock. | 242 // while holding that lock. |