17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp" 27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 28 #include "gc_implementation/g1/g1CollectorPolicy.hpp" 29 #include "gc_implementation/g1/g1Log.hpp" 30 #include "gc_implementation/g1/vm_operations_g1.hpp" 31 #include "gc_implementation/shared/gcTimer.hpp" 32 #include "gc_implementation/shared/gcTraceTime.hpp" 33 #include "gc_implementation/shared/isGCActiveMark.hpp" 34 #include "gc_implementation/g1/vm_operations_g1.hpp" 35 #include "runtime/interfaceSupport.hpp" 36 37 bool VM_G1OperationWithAllocRequest::doit_prologue() { 38 bool succeeded = VM_CollectForAllocation::doit_prologue(); 39 if (succeeded) { 40 G1CollectedHeap::heap()->set_heap_lock_held_for_gc(true); 41 } 42 return succeeded; 43 } 44 45 void VM_G1OperationWithAllocRequest::doit_epilogue() { 46 G1CollectedHeap::heap()->set_heap_lock_held_for_gc(false); 47 VM_CollectForAllocation::doit_epilogue(); 48 } 49 50 VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before, 51 size_t word_size) 52 : VM_G1OperationWithAllocRequest(gc_count_before, word_size, 53 GCCause::_allocation_failure) { 54 guarantee(word_size != 0, "An allocation should always be requested with this operation."); 55 } 56 57 void VM_G1CollectForAllocation::doit() { 58 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 59 GCCauseSetter x(g1h, _gc_cause); 60 61 _result = g1h->satisfy_failed_allocation(_word_size, allocation_context(), &_pause_succeeded); 62 assert(_result == NULL || _pause_succeeded, 63 "if we get back a result, the pause should have succeeded"); 64 } 65 66 void VM_G1CollectFull::doit() { 67 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 68 GCCauseSetter x(g1h, _gc_cause); 69 g1h->do_full_collection(false /* clear_all_soft_refs */); 235 ConcurrentMarkThread::slt()-> 236 manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); 237 } 238 239 void VM_CGC_Operation::doit() { 240 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 241 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 242 GCTraceTime t(_printGCMessage, G1Log::fine(), true, g1h->gc_timer_cm(), g1h->concurrent_mark()->concurrent_gc_id()); 243 IsGCActiveMark x; 244 _cl->do_void(); 245 } 246 247 bool VM_CGC_Operation::doit_prologue() { 248 // Note the relative order of the locks must match that in 249 // VM_GC_Operation::doit_prologue() or deadlocks can occur 250 if (_needs_pll) { 251 acquire_pending_list_lock(); 252 } 253 254 Heap_lock->lock(); 255 G1CollectedHeap::heap()->set_heap_lock_held_for_gc(true); 256 return true; 257 } 258 259 void VM_CGC_Operation::doit_epilogue() { 260 // Note the relative order of the unlocks must match that in 261 // VM_GC_Operation::doit_epilogue() 262 G1CollectedHeap::heap()->set_heap_lock_held_for_gc(false); 263 Heap_lock->unlock(); 264 if (_needs_pll) { 265 release_and_notify_pending_list_lock(); 266 } 267 } | 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp" 27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 28 #include "gc_implementation/g1/g1CollectorPolicy.hpp" 29 #include "gc_implementation/g1/g1Log.hpp" 30 #include "gc_implementation/g1/vm_operations_g1.hpp" 31 #include "gc_implementation/shared/gcTimer.hpp" 32 #include "gc_implementation/shared/gcTraceTime.hpp" 33 #include "gc_implementation/shared/isGCActiveMark.hpp" 34 #include "gc_implementation/g1/vm_operations_g1.hpp" 35 #include "runtime/interfaceSupport.hpp" 36 37 VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before, 38 size_t word_size) 39 : VM_G1OperationWithAllocRequest(gc_count_before, word_size, 40 GCCause::_allocation_failure) { 41 guarantee(word_size != 0, "An allocation should always be requested with this operation."); 42 } 43 44 void VM_G1CollectForAllocation::doit() { 45 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 46 GCCauseSetter x(g1h, _gc_cause); 47 48 _result = g1h->satisfy_failed_allocation(_word_size, allocation_context(), &_pause_succeeded); 49 assert(_result == NULL || _pause_succeeded, 50 "if we get back a result, the pause should have succeeded"); 51 } 52 53 void VM_G1CollectFull::doit() { 54 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 55 GCCauseSetter x(g1h, _gc_cause); 56 g1h->do_full_collection(false /* clear_all_soft_refs */); 222 ConcurrentMarkThread::slt()-> 223 manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); 224 } 225 226 void VM_CGC_Operation::doit() { 227 TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); 228 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 229 GCTraceTime t(_printGCMessage, G1Log::fine(), true, g1h->gc_timer_cm(), g1h->concurrent_mark()->concurrent_gc_id()); 230 IsGCActiveMark x; 231 _cl->do_void(); 232 } 233 234 bool VM_CGC_Operation::doit_prologue() { 235 // Note the relative order of the locks must match that in 236 // VM_GC_Operation::doit_prologue() or deadlocks can occur 237 if (_needs_pll) { 238 acquire_pending_list_lock(); 239 } 240 241 Heap_lock->lock(); 242 return true; 243 } 244 245 void VM_CGC_Operation::doit_epilogue() { 246 // Note the relative order of the unlocks must match that in 247 // VM_GC_Operation::doit_epilogue() 248 Heap_lock->unlock(); 249 if (_needs_pll) { 250 release_and_notify_pending_list_lock(); 251 } 252 } |