Summary
-------
Deprecate the -XX:MonitorBound=N flag
Problem
-------
The product flag, MonitorBound, was added in JDK 7-B99 by JDK-6852873.
It was also backported to various JDK6 update releases. The flag was added
as a way to control how often the system invoked a cleanup safepoint for
reducing the number of idle ObjectMonitors.
An experimental flag MonitorUsedDeflationThreshold was added in JDK 10-B21
by JDK-8181859 to control when idle monitor deflation is invoked. The new flag
is described:
experimental(intx, MonitorUsedDeflationThreshold, 90, \
"Percentage of used monitors before triggering cleanup " \
"safepoint which deflates monitors (0 is off). " \
"The check is performed on GuaranteedSafepointInterval.") \
range(0, 100)
A policy based on the percentage of used monitors is a more flexible
mechanism that the fixed limit specified by MonitorBound. The MonitorBound
option should have been deprecated back in JDK 10, but we missed that
detail.
Solution
--------
Deprecate the -XX:MonitorBound=N flag.
The flag will still be accepted and acted upon but a deprecation warning will be issued.
The flag will be obsoleted in JDK 15 and removed in JDK 16.
Specification
-------------
diff -r f63f50a4bf43 src/hotspot/share/runtime/arguments.cpp
--- a/src/hotspot/share/runtime/arguments.cpp Thu Sep 12 11:07:35 2019 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp Thu Sep 12 20:44:45 2019 -0400
@@ -539,6 +539,7 @@
{ "FlightRecorder", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "FieldsAllocationStyle", JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
{ "CompactFields", JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
+ { "MonitorBound", JDK_Version::jdk(14), JDK_Version::jdk(15), JDK_Version::jdk(16) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
diff -r f63f50a4bf43 src/hotspot/share/runtime/globals.hpp
--- a/src/hotspot/share/runtime/globals.hpp Thu Sep 12 11:07:35 2019 -0700
+++ b/src/hotspot/share/runtime/globals.hpp Thu Sep 12 20:44:45 2019 -0400
@@ -713,7 +713,7 @@
"Use LWP-based instead of libthread-based synchronization " \
"(SPARC only)") \
\
- product(intx, MonitorBound, 0, "Bound Monitor population") \
+ product(intx, MonitorBound, 0, "(Deprecated) Bound Monitor population") \
range(0, max_jint) \
\
experimental(intx, MonitorUsedDeflationThreshold, 90, \