< prev index next >
src/share/vm/gc/shenandoah/shenandoahPartialGC.cpp
Print this page
rev 13092 : Offer termination before leaving on cancelled GC.
*** 94,104 ****
PartialEvacuateUpdateRootsClosure roots_cl(q);
CLDToOopClosure cld_cl(&roots_cl);
MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations);
_rp->process_all_roots(&roots_cl, &roots_cl, &cld_cl, &code_cl, worker_id);
}
! if (_heap->cancelled_concgc()) return;
PartialEvacuateUpdateHeapClosure cl(q);
// Step 2: Process all root regions.
{
--- 94,104 ----
PartialEvacuateUpdateRootsClosure roots_cl(q);
CLDToOopClosure cld_cl(&roots_cl);
MarkingCodeBlobClosure code_cl(&roots_cl, CodeBlobToOopClosure::FixRelocations);
_rp->process_all_roots(&roots_cl, &roots_cl, &cld_cl, &code_cl, worker_id);
}
! if (check_and_handle_cancelled_gc()) return;
PartialEvacuateUpdateHeapClosure cl(q);
// Step 2: Process all root regions.
{
*** 109,133 ****
matrix->clear_region_outbound(r->region_number());
assert(r->is_root(), "must be root region");
r->oop_iterate(&cl);
r->set_root(false);
! if (_heap->cancelled_concgc()) return;
r = _root_regions->claim_next();
}
}
! if (_heap->cancelled_concgc()) return;
// Step 3: Drain all outstanding work in queues.
{
int seed = 17;
SCMTask task;
uint stride = ShenandoahMarkLoopStride;
while (true) {
! if (_heap->cancelled_concgc()) return;
for (uint i = 0; i < stride; i++) {
if ((q->pop_buffer(task) ||
q->pop_local(task) ||
q->pop_overflow(task) ||
--- 109,133 ----
matrix->clear_region_outbound(r->region_number());
assert(r->is_root(), "must be root region");
r->oop_iterate(&cl);
r->set_root(false);
! if (check_and_handle_cancelled_gc()) return;
r = _root_regions->claim_next();
}
}
! if (check_and_handle_cancelled_gc()) return;
// Step 3: Drain all outstanding work in queues.
{
int seed = 17;
SCMTask task;
uint stride = ShenandoahMarkLoopStride;
while (true) {
! if (check_and_handle_cancelled_gc()) return;
for (uint i = 0; i < stride; i++) {
if ((q->pop_buffer(task) ||
q->pop_local(task) ||
q->pop_overflow(task) ||
*** 141,150 ****
--- 141,159 ----
}
}
}
}
+ private:
+ bool check_and_handle_cancelled_gc() {
+ if (_heap->cancelled_concgc()) {
+ ShenandoahCancelledTerminatorTerminator tt;
+ while (! _terminator->offer_termination(&tt));
+ return true;
+ }
+ return false;
+ }
};
ShenandoahPartialGC::ShenandoahPartialGC(ShenandoahHeap* heap, uint max_regions) :
_heap(heap),
_matrix(heap->connection_matrix()),
< prev index next >