< prev index next >
src/hotspot/share/runtime/serviceThread.cpp
Print this page
rev 56044 : imported patch 8230184.patch
rev 56046 : v2.00 -> v2.05 (CR5/v2.05/8-for-jdk13) patches combined into one; merge with 8229212.patch; merge with jdk-14+11; merge with 8230184.patch.
rev 56049 : Merge the remainder of the lock-free monitor list changes from v2.06 with v2.06a and v2.06b after running the changes through the edit scripts; merge pieces from dcubed.monitor_deflate_conc.v2.06d in dcubed.monitor_deflate_conc.v2.06[ac]; merge pieces from dcubed.monitor_deflate_conc.v2.06e into dcubed.monitor_deflate_conc.v2.06c; merge with jdk-14+11; test work around for test/jdk/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java should not been needed anymore.
@@ -107,10 +107,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.
@@ -132,14 +133,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())
+ (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();
}
@@ -178,10 +183,31 @@
}
if (oopstorage_work) {
cleanup_oopstorages(oopstorages, oopstorage_count);
}
+
+ if (deflate_idle_monitors) {
+ // Deflate any global idle monitors.
+ ObjectSynchronizer::deflate_global_idle_monitors_using_JT();
+
+ int count = 0;
+ for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
+ if (jt->om_in_use_count > 0 && !jt->is_exiting()) {
+ // This JavaThread is using ObjectMonitors so deflate any that
+ // are idle unless this JavaThread is exiting; do not race with
+ // ObjectSynchronizer::om_flush().
+ ObjectSynchronizer::deflate_per_thread_idle_monitors_using_JT(jt);
+ count++;
+ }
+ }
+ if (count > 0) {
+ log_debug(monitorinflation)("did 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);
+ }
}
}
bool ServiceThread::is_service_thread(Thread* thread) {
return thread == _instance;
< prev index next >