< prev index next >
src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp
Print this page
*** 1708,1721 ****
assert(Thread::current()->is_ConcurrentGC_thread(),
"A CMS asynchronous collection is only allowed on a CMS thread.");
CMSHeap* heap = CMSHeap::heap();
{
! bool safepoint_check = Mutex::_no_safepoint_check_flag;
! MutexLockerEx hl(Heap_lock, safepoint_check);
FreelistLocker fll(this);
! MutexLockerEx x(CGC_lock, safepoint_check);
if (_foregroundGCIsActive) {
// The foreground collector is. Skip this
// background collection.
assert(!_foregroundGCShouldWait, "Should be clear");
return;
--- 1708,1720 ----
assert(Thread::current()->is_ConcurrentGC_thread(),
"A CMS asynchronous collection is only allowed on a CMS thread.");
CMSHeap* heap = CMSHeap::heap();
{
! MutexLocker hl(Heap_lock);
FreelistLocker fll(this);
! MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
if (_foregroundGCIsActive) {
// The foreground collector is. Skip this
// background collection.
assert(!_foregroundGCShouldWait, "Should be clear");
return;
*** 1855,1865 ****
// Don't move the call to compute_new_size() down
// into code that might be executed if the background
// collection was preempted.
{
ReleaseForegroundGC x(this); // unblock FG collection
! MutexLockerEx y(Heap_lock, Mutex::_no_safepoint_check_flag);
CMSTokenSync z(true); // not strictly needed.
if (_collectorState == Resizing) {
compute_new_size();
save_heap_summary();
_collectorState = Resetting;
--- 1854,1864 ----
// Don't move the call to compute_new_size() down
// into code that might be executed if the background
// collection was preempted.
{
ReleaseForegroundGC x(this); // unblock FG collection
! MutexLocker y(Heap_lock);
CMSTokenSync z(true); // not strictly needed.
if (_collectorState == Resizing) {
compute_new_size();
save_heap_summary();
_collectorState = Resetting;
*** 7956,7966 ****
}
void CMSCollector::par_preserve_mark_if_necessary(oop p) {
markOop m = p->mark_raw();
if (m->must_be_preserved(p)) {
! MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
// Even though we read the mark word without holding
// the lock, we are assured that it will not change
// because we "own" this oop, so no other thread can
// be trying to push it on the overflow list; see
// the assertion in preserve_mark_work() that checks
--- 7955,7965 ----
}
void CMSCollector::par_preserve_mark_if_necessary(oop p) {
markOop m = p->mark_raw();
if (m->must_be_preserved(p)) {
! MutexLocker x(ParGCRareEvent_lock);
// Even though we read the mark word without holding
// the lock, we are assured that it will not change
// because we "own" this oop, so no other thread can
// be trying to push it on the overflow list; see
// the assertion in preserve_mark_work() that checks
< prev index next >