8262087: Use atomic boolean type in G1FullGCAdjustTask
Reviewed-by: kbarrett, tschatzl
This commit is contained in:
parent
a5c4b9a6b0
commit
12f6ba0deb
@ -81,7 +81,7 @@ class G1AdjustRegionClosure : public HeapRegionClosure {
|
|||||||
G1FullGCAdjustTask::G1FullGCAdjustTask(G1FullCollector* collector) :
|
G1FullGCAdjustTask::G1FullGCAdjustTask(G1FullCollector* collector) :
|
||||||
G1FullGCTask("G1 Adjust", collector),
|
G1FullGCTask("G1 Adjust", collector),
|
||||||
_root_processor(G1CollectedHeap::heap(), collector->workers()),
|
_root_processor(G1CollectedHeap::heap(), collector->workers()),
|
||||||
_references_done(0),
|
_references_done(false),
|
||||||
_weak_proc_task(collector->workers()),
|
_weak_proc_task(collector->workers()),
|
||||||
_hrclaimer(collector->workers()),
|
_hrclaimer(collector->workers()),
|
||||||
_adjust(collector),
|
_adjust(collector),
|
||||||
@ -99,8 +99,7 @@ void G1FullGCAdjustTask::work(uint worker_id) {
|
|||||||
marker->preserved_stack()->adjust_during_full_gc();
|
marker->preserved_stack()->adjust_during_full_gc();
|
||||||
|
|
||||||
// Adjust the weak roots.
|
// Adjust the weak roots.
|
||||||
|
if (!Atomic::cmpxchg(&_references_done, false, true)) {
|
||||||
if (Atomic::add(&_references_done, 1u) == 1u) { // First incr claims task.
|
|
||||||
G1CollectedHeap::heap()->ref_processor_stw()->weak_oops_do(&_adjust);
|
G1CollectedHeap::heap()->ref_processor_stw()->weak_oops_do(&_adjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class G1CollectedHeap;
|
|||||||
|
|
||||||
class G1FullGCAdjustTask : public G1FullGCTask {
|
class G1FullGCAdjustTask : public G1FullGCTask {
|
||||||
G1RootProcessor _root_processor;
|
G1RootProcessor _root_processor;
|
||||||
volatile uint _references_done; // Atomic counter / bool
|
volatile bool _references_done;
|
||||||
WeakProcessor::Task _weak_proc_task;
|
WeakProcessor::Task _weak_proc_task;
|
||||||
HeapRegionClaimer _hrclaimer;
|
HeapRegionClaimer _hrclaimer;
|
||||||
G1AdjustClosure _adjust;
|
G1AdjustClosure _adjust;
|
||||||
|
Loading…
Reference in New Issue
Block a user