< prev index next >

src/share/vm/runtime/synchronizer.cpp

Print this page
rev 13387 : [mq]: parallel_sp_cleaning.patch

*** 1684,1717 **** } } return deflated_count; } ! void ObjectSynchronizer::deflate_idle_monitors() { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); int nInuse = 0; // currently associated with objects int nInCirculation = 0; // extant int nScavenged = 0; // reclaimed bool deflated = false; ObjectMonitor * freeHeadp = NULL; // Local SLL of scavenged monitors ObjectMonitor * freeTailp = NULL; TEVENT(deflate_idle_monitors); - if (MonitorInUseLists) { - if (! Universe::heap()->supports_per_thread_monitor_deflation() || - ForceMonitorScavenge == 1) { - Universe::heap()->deflate_idle_monitors_all_threads(); - } - } - // Prevent omFlush from changing mids in Thread dtor's during deflation // And in case the vm thread is acquiring a lock during a safepoint // See e.g. 6320749 Thread::muxAcquire(&gListLock, "scavenge - return"); if (MonitorInUseLists) { // For moribund threads, scan gOmInUseList if (gOmInUseList) { nInCirculation += gOmInUseCount; int deflated_count = deflate_monitor_list((ObjectMonitor **)&gOmInUseList, &freeHeadp, &freeTailp); gOmInUseCount-= deflated_count; --- 1684,1723 ---- } } return deflated_count; } ! void ObjectSynchronizer::deflate_idle_monitors(bool deflate_thread_local_monitors) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); int nInuse = 0; // currently associated with objects int nInCirculation = 0; // extant int nScavenged = 0; // reclaimed bool deflated = false; ObjectMonitor * freeHeadp = NULL; // Local SLL of scavenged monitors ObjectMonitor * freeTailp = NULL; TEVENT(deflate_idle_monitors); // Prevent omFlush from changing mids in Thread dtor's during deflation // And in case the vm thread is acquiring a lock during a safepoint // See e.g. 6320749 Thread::muxAcquire(&gListLock, "scavenge - return"); if (MonitorInUseLists) { + if (deflate_thread_local_monitors) { + for (JavaThread* cur = Threads::first(); cur != NULL; cur = cur->next()) { + nInCirculation+= cur->omInUseCount; + int deflated_count = deflate_monitor_list(cur->omInUseList_addr(), &freeHeadp, &freeTailp); + cur->omInUseCount-= deflated_count; + if (ObjectMonitor::Knob_VerifyInUse) { + verifyInUse(cur); + } + nScavenged += deflated_count; + nInuse += cur->omInUseCount; + } + } + // For moribund threads, scan gOmInUseList if (gOmInUseList) { nInCirculation += gOmInUseCount; int deflated_count = deflate_monitor_list((ObjectMonitor **)&gOmInUseList, &freeHeadp, &freeTailp); gOmInUseCount-= deflated_count;
*** 1784,1795 **** } void ObjectSynchronizer::deflate_idle_monitors_and_oops_do(Thread* thread, OopClosure* cl) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); if (! MonitorInUseLists) return; - if (ForceMonitorScavenge == 1) return; - assert(Universe::heap()->supports_per_thread_monitor_deflation(), "only call this when supported by GC"); ObjectMonitor * freeHeadp = NULL; // Local SLL of scavenged monitors ObjectMonitor * freeTailp = NULL; int deflated_count = deflate_monitor_list(thread->omInUseList_addr(), &freeHeadp, &freeTailp, cl); --- 1790,1799 ----
< prev index next >