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