< prev index next >

src/share/vm/gc_implementation/g1/vm_operations_g1.cpp

Print this page

        

*** 32,41 **** --- 32,54 ---- #include "gc_implementation/shared/gcTraceTime.hpp" #include "gc_implementation/shared/isGCActiveMark.hpp" #include "gc_implementation/g1/vm_operations_g1.hpp" #include "runtime/interfaceSupport.hpp" + bool VM_G1OperationWithAllocRequest::doit_prologue() { + bool succeeded = VM_CollectForAllocation::doit_prologue(); + if (succeeded) { + G1CollectedHeap::heap()->set_heap_lock_held_for_gc(true); + } + return succeeded; + } + + void VM_G1OperationWithAllocRequest::doit_epilogue() { + G1CollectedHeap::heap()->set_heap_lock_held_for_gc(false); + VM_CollectForAllocation::doit_epilogue(); + } + VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before, size_t word_size) : VM_G1OperationWithAllocRequest(gc_count_before, word_size, GCCause::_allocation_failure) { guarantee(word_size != 0, "An allocation should always be requested with this operation.");
*** 223,259 **** manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); } void VM_CGC_Operation::doit() { TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); ! GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id()); ! SharedHeap* sh = SharedHeap::heap(); ! // This could go away if CollectedHeap gave access to _gc_is_active... ! if (sh != NULL) { IsGCActiveMark x; _cl->do_void(); - } else { - _cl->do_void(); - } } bool VM_CGC_Operation::doit_prologue() { // Note the relative order of the locks must match that in // VM_GC_Operation::doit_prologue() or deadlocks can occur if (_needs_pll) { acquire_pending_list_lock(); } Heap_lock->lock(); ! SharedHeap::heap()->_thread_holds_heap_lock_for_gc = true; return true; } void VM_CGC_Operation::doit_epilogue() { // Note the relative order of the unlocks must match that in // VM_GC_Operation::doit_epilogue() ! SharedHeap::heap()->_thread_holds_heap_lock_for_gc = false; Heap_lock->unlock(); if (_needs_pll) { release_and_notify_pending_list_lock(); } } --- 236,267 ---- manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); } void VM_CGC_Operation::doit() { TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); ! G1CollectedHeap* g1h = G1CollectedHeap::heap(); ! GCTraceTime t(_printGCMessage, G1Log::fine(), true, g1h->gc_timer_cm(), g1h->concurrent_mark()->concurrent_gc_id()); IsGCActiveMark x; _cl->do_void(); } bool VM_CGC_Operation::doit_prologue() { // Note the relative order of the locks must match that in // VM_GC_Operation::doit_prologue() or deadlocks can occur if (_needs_pll) { acquire_pending_list_lock(); } Heap_lock->lock(); ! G1CollectedHeap::heap()->set_heap_lock_held_for_gc(true); return true; } void VM_CGC_Operation::doit_epilogue() { // Note the relative order of the unlocks must match that in // VM_GC_Operation::doit_epilogue() ! G1CollectedHeap::heap()->set_heap_lock_held_for_gc(false); Heap_lock->unlock(); if (_needs_pll) { release_and_notify_pending_list_lock(); } }
< prev index next >