< prev index next >

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

Print this page




 156                                       true /* expect_null_cur_alloc_region */);
 157   } else {
 158     assert(_result == NULL, "invariant");
 159     if (!_pause_succeeded) {
 160       // Another possible reason reason for the pause to not be successful
 161       // is that, again, the GC locker is active (and has become active
 162       // since the prologue was executed). In this case we should retry
 163       // the pause after waiting for the GC locker to become inactive.
 164       _should_retry_gc = true;
 165     }
 166   }
 167 }
 168 
 169 void VM_G1IncCollectionPause::doit_epilogue() {
 170   VM_G1OperationWithAllocRequest::doit_epilogue();
 171 
 172   // If the pause was initiated by a System.gc() and
 173   // +ExplicitGCInvokesConcurrent, we have to wait here for the cycle
 174   // that just started (or maybe one that was already in progress) to
 175   // finish.
 176   if (_gc_cause == GCCause::_java_lang_system_gc &&
 177       _should_initiate_conc_mark) {
 178     assert(ExplicitGCInvokesConcurrent,
 179            "the only way to be here is if ExplicitGCInvokesConcurrent is set");
 180 
 181     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 182 
 183     // In the doit() method we saved g1h->old_marking_cycles_completed()
 184     // in the _old_marking_cycles_completed_before field. We have to
 185     // wait until we observe that g1h->old_marking_cycles_completed()
 186     // has increased by at least one. This can happen if a) we started
 187     // a cycle and it completes, b) a cycle already in progress
 188     // completes, or c) a Full GC happens.
 189 
 190     // If the condition has already been reached, there's no point in
 191     // actually taking the lock and doing the wait.
 192     if (g1h->old_marking_cycles_completed() <=
 193                                           _old_marking_cycles_completed_before) {
 194       // The following is largely copied from CMS
 195 
 196       Thread* thr = Thread::current();




 156                                       true /* expect_null_cur_alloc_region */);
 157   } else {
 158     assert(_result == NULL, "invariant");
 159     if (!_pause_succeeded) {
 160       // Another possible reason reason for the pause to not be successful
 161       // is that, again, the GC locker is active (and has become active
 162       // since the prologue was executed). In this case we should retry
 163       // the pause after waiting for the GC locker to become inactive.
 164       _should_retry_gc = true;
 165     }
 166   }
 167 }
 168 
 169 void VM_G1IncCollectionPause::doit_epilogue() {
 170   VM_G1OperationWithAllocRequest::doit_epilogue();
 171 
 172   // If the pause was initiated by a System.gc() and
 173   // +ExplicitGCInvokesConcurrent, we have to wait here for the cycle
 174   // that just started (or maybe one that was already in progress) to
 175   // finish.
 176   if (GCCause::is_user_requested_gc(_gc_cause) &&
 177       _should_initiate_conc_mark) {
 178     assert(ExplicitGCInvokesConcurrent,
 179            "the only way to be here is if ExplicitGCInvokesConcurrent is set");
 180 
 181     G1CollectedHeap* g1h = G1CollectedHeap::heap();
 182 
 183     // In the doit() method we saved g1h->old_marking_cycles_completed()
 184     // in the _old_marking_cycles_completed_before field. We have to
 185     // wait until we observe that g1h->old_marking_cycles_completed()
 186     // has increased by at least one. This can happen if a) we started
 187     // a cycle and it completes, b) a cycle already in progress
 188     // completes, or c) a Full GC happens.
 189 
 190     // If the condition has already been reached, there's no point in
 191     // actually taking the lock and doing the wait.
 192     if (g1h->old_marking_cycles_completed() <=
 193                                           _old_marking_cycles_completed_before) {
 194       // The following is largely copied from CMS
 195 
 196       Thread* thr = Thread::current();


< prev index next >