src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
Print this page
rev 6626 : imported patch 8035400-move-g1parscanthreadstate-into-own-files
rev 6627 : imported patch 8035400-2-bengt-fixes
rev 6628 : imported patch 8035401-fix-visibility-of-g1parscanthreadstate
*** 4667,4694 ****
pss->end_term_time();
return res;
}
void G1ParEvacuateFollowersClosure::do_void() {
- StarTask stolen_task;
G1ParScanThreadState* const pss = par_scan_state();
pss->trim_queue();
-
do {
! while (queues()->steal(pss->queue_num(), pss->hash_seed(), stolen_task)) {
! assert(pss->verify_task(stolen_task), "sanity");
! if (stolen_task.is_narrow()) {
! pss->deal_with_reference((narrowOop*) stolen_task);
! } else {
! pss->deal_with_reference((oop*) stolen_task);
! }
!
! // We've just processed a reference and we might have made
! // available new entries on the queues. So we have to make sure
! // we drain the queues as necessary.
! pss->trim_queue();
! }
} while (!offer_termination());
}
class G1KlassScanClosure : public KlassClosure {
G1ParCopyHelper* _closure;
--- 4667,4680 ----
pss->end_term_time();
return res;
}
void G1ParEvacuateFollowersClosure::do_void() {
G1ParScanThreadState* const pss = par_scan_state();
pss->trim_queue();
do {
! pss->steal_and_trim_queue(queues());
} while (!offer_termination());
}
class G1KlassScanClosure : public KlassClosure {
G1ParCopyHelper* _closure;
*** 4730,4741 ****
return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1)
/ G1BlockOffsetSharedArray::N_bytes;
}
public:
! G1ParTask(G1CollectedHeap* g1h,
! RefToScanQueueSet *task_queues)
: AbstractGangTask("G1 collection"),
_g1h(g1h),
_queues(task_queues),
_terminator(0, _queues),
_stats_lock(Mutex::leaf, "parallel G1 stats lock", true)
--- 4716,4726 ----
return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1)
/ G1BlockOffsetSharedArray::N_bytes;
}
public:
! G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues)
: AbstractGangTask("G1 collection"),
_g1h(g1h),
_queues(task_queues),
_terminator(0, _queues),
_stats_lock(Mutex::leaf, "parallel G1 stats lock", true)
*** 4829,4839 ****
if (ParallelGCVerbose) {
MutexLocker x(stats_lock());
pss.print_termination_stats(worker_id);
}
! assert(pss.refs()->is_empty(), "should be empty");
// Close the inner scope so that the ResourceMark and HandleMark
// destructors are executed here and are included as part of the
// "GC Worker Time".
}
--- 4814,4824 ----
if (ParallelGCVerbose) {
MutexLocker x(stats_lock());
pss.print_termination_stats(worker_id);
}
! assert(pss.queue_is_empty(), "should be empty");
// Close the inner scope so that the ResourceMark and HandleMark
// destructors are executed here and are included as part of the
// "GC Worker Time".
}
*** 5353,5364 ****
G1ParScanThreadState pss(_g1h, worker_id, NULL);
G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
pss.set_evac_failure_closure(&evac_failure_cl);
! assert(pss.refs()->is_empty(), "both queue and overflow should be empty");
!
G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL);
G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL);
--- 5338,5348 ----
G1ParScanThreadState pss(_g1h, worker_id, NULL);
G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
pss.set_evac_failure_closure(&evac_failure_cl);
! assert(pss.queue_is_empty(), "both queue and overflow should be empty");
G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL);
G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL);
*** 5408,5418 ****
// Drain the queue - which may cause stealing
G1ParEvacuateFollowersClosure drain_queue(_g1h, &pss, _queues, &_terminator);
drain_queue.do_void();
// Allocation buffers were retired at the end of G1ParEvacuateFollowersClosure
! assert(pss.refs()->is_empty(), "should be");
}
};
// Weak Reference processing during an evacuation pause (part 1).
void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
--- 5392,5402 ----
// Drain the queue - which may cause stealing
G1ParEvacuateFollowersClosure drain_queue(_g1h, &pss, _queues, &_terminator);
drain_queue.do_void();
// Allocation buffers were retired at the end of G1ParEvacuateFollowersClosure
! assert(pss.queue_is_empty(), "should be");
}
};
// Weak Reference processing during an evacuation pause (part 1).
void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
*** 5475,5485 ****
// reference objects.
G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL);
pss.set_evac_failure_closure(&evac_failure_cl);
! assert(pss.refs()->is_empty(), "pre-condition");
G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL);
G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, &pss, NULL);
--- 5459,5469 ----
// reference objects.
G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL);
pss.set_evac_failure_closure(&evac_failure_cl);
! assert(pss.queue_is_empty(), "pre-condition");
G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL);
G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, &pss, NULL);
*** 5523,5533 ****
}
_gc_tracer_stw->report_gc_reference_stats(stats);
// We have completed copying any necessary live referent objects.
! assert(pss.refs()->is_empty(), "both queue and overflow should be empty");
double ref_proc_time = os::elapsedTime() - ref_proc_start;
g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
}
--- 5507,5517 ----
}
_gc_tracer_stw->report_gc_reference_stats(stats);
// We have completed copying any necessary live referent objects.
! assert(pss.queue_is_empty(), "both queue and overflow should be empty");
double ref_proc_time = os::elapsedTime() - ref_proc_start;
g1_policy()->phase_times()->record_ref_proc_time(ref_proc_time * 1000.0);
}