< prev index next >
src/hotspot/share/runtime/serviceThread.cpp
Print this page
rev 55489 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.
rev 55493 : imported patch dcubed.monitor_deflate_conc.v2.04
rev 55494 : imported patch dcubed.monitor_deflate_conc.v2.05
@@ -106,10 +106,11 @@
bool stringtable_work = false;
bool symboltable_work = false;
bool resolved_method_table_work = false;
bool protection_domain_table_work = false;
bool oopstorage_work = false;
+ bool deflate_idle_monitors = false;
JvmtiDeferredEvent jvmti_event;
{
// Need state transition ThreadBlockInVM so that this thread
// will be handled by safepoint correctly when this thread is
// notified at a safepoint.
@@ -131,14 +132,18 @@
(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification()) |
(stringtable_work = StringTable::has_work()) |
(symboltable_work = SymbolTable::has_work()) |
(resolved_method_table_work = ResolvedMethodTable::has_work()) |
(protection_domain_table_work = SystemDictionary::pd_cache_table()->has_work()) |
- (oopstorage_work = OopStorage::has_cleanup_work_and_reset()))
- == 0) {
+ (oopstorage_work = OopStorage::has_cleanup_work_and_reset()) |
+ (deflate_idle_monitors = ObjectSynchronizer::is_async_deflation_needed())
+ ) == 0) {
// Wait until notified that there is some work to do.
- ml.wait();
+ // If AsyncDeflateIdleMonitors, then we wait for
+ // GuaranteedSafepointInterval so that is_async_deflation_needed()
+ // is checked at the same interval.
+ ml.wait(AsyncDeflateIdleMonitors ? GuaranteedSafepointInterval : 0);
}
if (has_jvmti_events) {
jvmti_event = JvmtiDeferredEventQueue::dequeue();
}
@@ -177,10 +182,35 @@
}
if (oopstorage_work) {
cleanup_oopstorages(oopstorages, oopstorage_count);
}
+
+ if (deflate_idle_monitors) {
+ // Deflate any global idle monitors.
+ ObjectSynchronizer::deflate_global_idle_monitors_using_JT();
+
+ // deflate_per_thread_idle_monitors_using_JT() is called by
+ // each JavaThread from ObjectSynchronizer::omAlloc() as needed.
+ int count = 0;
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
+ if (jt->omInUseCount > 0) {
+ // This JavaThread is using monitors so mark it.
+ jt->omShouldDeflateIdleMonitors = true;
+ count++;
+ }
+ }
+ if (count > 0) {
+ log_debug(monitorinflation)("requesting async deflation of idle monitors for %d thread(s).", count);
+ }
+ // The ServiceThread's async deflation request has been processed.
+ ObjectSynchronizer::set_is_async_deflation_requested(false);
+
+ // The global in-use list was handled above, but the request won't
+ // be complete until the JavaThreads have handled their in-use
+ // lists. This is the nature of an async deflation request.
+ }
}
}
bool ServiceThread::is_service_thread(Thread* thread) {
return thread == _instance;
< prev index next >