8231264: Implementation of JEP 374: Disable biased-locking and deprecate all flags related to biased-locking

Changed default value of UseBiasedLocking to false and deprecated related flags.

Reviewed-by: dholmes, dcubed
This commit is contained in:
Patricio Chilano Mateo 2020-05-13 15:47:10 +00:00
parent ca53ee2593
commit 398a2b3c37
5 changed files with 44 additions and 29 deletions

View File

@ -497,7 +497,8 @@
"Print precise statistics on the dynamic lock usage") \
\
diagnostic(bool, PrintPreciseBiasedLockingStatistics, false, \
"Print per-lock-site statistics of biased locking in JVM") \
"(Deprecated) Print per-lock-site statistics of biased locking " \
"in JVM") \
\
diagnostic(bool, PrintPreciseRTMLockingStatistics, false, \
"Print per-lock-site statistics of rtm locking in JVM") \
@ -551,7 +552,7 @@
"Verify Connection Graph construction in Escape Analysis") \
\
product(bool, UseOptoBiasInlining, true, \
"Generate biased locking code in C2 ideal graph") \
"(Deprecated) Generate biased locking code in C2 ideal graph") \
\
product(bool, OptimizeStringConcat, true, \
"Optimize the construction of Strings by StringBuilder") \

View File

@ -525,6 +525,14 @@ static SpecialFlag const special_jvm_flags[] = {
{ "PrintVMQWaitTime", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseNewFieldLayout", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "ForceNUMA", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseBiasedLocking", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "BiasedLockingStartupDelay", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "PrintBiasedLockingStatistics", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "BiasedLockingBulkRebiasThreshold", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "BiasedLockingBulkRevokeThreshold", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "BiasedLockingDecayTime", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "UseOptoBiasInlining", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
{ "PrintPreciseBiasedLockingStatistics", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
// --- 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() },

View File

@ -777,32 +777,34 @@ const size_t minimumSymbolTableSize = 1024;
product(bool, RestrictContended, true, \
"Restrict @Contended to trusted classes") \
\
product(bool, UseBiasedLocking, true, \
"Enable biased locking in JVM") \
product(bool, UseBiasedLocking, false, \
"(Deprecated) Enable biased locking in JVM") \
\
product(intx, BiasedLockingStartupDelay, 0, \
"Number of milliseconds to wait before enabling biased locking") \
"(Deprecated) Number of milliseconds to wait before enabling " \
"biased locking") \
range(0, (intx)(max_jint-(max_jint%PeriodicTask::interval_gran))) \
constraint(BiasedLockingStartupDelayFunc,AfterErgo) \
\
diagnostic(bool, PrintBiasedLockingStatistics, false, \
"Print statistics of biased locking in JVM") \
"(Deprecated) Print statistics of biased locking in JVM") \
\
product(intx, BiasedLockingBulkRebiasThreshold, 20, \
"Threshold of number of revocations per type to try to " \
"rebias all objects in the heap of that type") \
"(Deprecated) Threshold of number of revocations per type to " \
"try to rebias all objects in the heap of that type") \
range(0, max_intx) \
constraint(BiasedLockingBulkRebiasThresholdFunc,AfterErgo) \
\
product(intx, BiasedLockingBulkRevokeThreshold, 40, \
"Threshold of number of revocations per type to permanently " \
"revoke biases of all objects in the heap of that type") \
"(Deprecated) Threshold of number of revocations per type to " \
"permanently revoke biases of all objects in the heap of that " \
"type") \
range(0, max_intx) \
constraint(BiasedLockingBulkRevokeThresholdFunc,AfterErgo) \
\
product(intx, BiasedLockingDecayTime, 25000, \
"Decay time (in milliseconds) to re-enable bulk rebiasing of a " \
"type after previous bulk rebias") \
"(Deprecated) Decay time (in milliseconds) to re-enable bulk " \
"rebiasing of a type after previous bulk rebias") \
range(500, max_intx) \
constraint(BiasedLockingDecayTimeFunc,AfterErgo) \
\

View File

@ -85,11 +85,6 @@ TEST_VM(markWord, printing) {
ThreadInVMfromNative invm(THREAD);
ResourceMark rm(THREAD);
if (!UseBiasedLocking || !BiasedLocking::enabled()) {
// Can't test this with biased locking disabled.
return;
}
oop obj = SystemDictionary::Byte_klass()->allocate_instance(THREAD);
FlagSetting fs(WizardMode, true);
@ -97,22 +92,25 @@ TEST_VM(markWord, printing) {
HandleMark hm(THREAD);
Handle h_obj(THREAD, obj);
// Biased locking is initially enabled for this java.lang.Byte object.
assert_test_pattern(h_obj, "is_biased");
if (UseBiasedLocking && BiasedLocking::enabled()) {
// Can't test this with biased locking disabled.
// Biased locking is initially enabled for this java.lang.Byte object.
assert_test_pattern(h_obj, "is_biased");
// Lock using biased locking.
BasicObjectLock lock;
lock.set_obj(obj);
markWord prototype_header = obj->klass()->prototype_header();
markWord mark = obj->mark();
markWord biased_mark = markWord::encode((JavaThread*) THREAD, mark.age(), prototype_header.bias_epoch());
obj->set_mark(biased_mark);
// Look for the biased_locker in markWord, not prototype_header.
// Lock using biased locking.
BasicObjectLock lock;
lock.set_obj(obj);
markWord prototype_header = obj->klass()->prototype_header();
markWord mark = obj->mark();
markWord biased_mark = markWord::encode((JavaThread*) THREAD, mark.age(), prototype_header.bias_epoch());
obj->set_mark(biased_mark);
// Look for the biased_locker in markWord, not prototype_header.
#ifdef _LP64
assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x0000000000000000");
assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x0000000000000000");
#else
assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x00000000");
assert_not_test_pattern(h_obj, "mark(is_biased biased_locker=0x00000000");
#endif
}
// Same thread tries to lock it again.
{

View File

@ -49,6 +49,12 @@ public class VMDeprecatedOptions {
{"AllowRedefinitionToAddDeleteMethods", "true"},
{"PrintVMQWaitTime", "true"},
{"UseNewFieldLayout", "true"},
{"UseBiasedLocking", "false"},
{"BiasedLockingStartupDelay", "0"},
{"BiasedLockingBulkRebiasThreshold", "20"},
{"BiasedLockingBulkRevokeThreshold", "40"},
{"BiasedLockingDecayTime", "25000"},
{"UseOptoBiasInlining", "true"},
// deprecated alias flags (see also aliased_jvm_flags):
{"DefaultMaxRAMFraction", "4"},