6840152: JVM crashes when heavyweight monitors are used
authorcoleenp
Wed, 16 Feb 2011 11:34:44 -0500
changeset 8309 e5c9c706242b
parent 8308 73dec186d97d
child 8311 39d37eed5241
6840152: JVM crashes when heavyweight monitors are used Summary: Turn off biased locking if !UseFastLocking or UseHeavyMonitors options are requested. Reviewed-by: phh, never, dcubed, dholmes
hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Feb 16 01:42:00 2011 -0500
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Feb 16 11:34:44 2011 -0500
@@ -3103,6 +3103,19 @@
   // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
   set_aggressive_opts_flags();
 
+  // Turn off biased locking for locking debug mode flags,
+  // which are subtlely different from each other but neither works with
+  // biased locking.
+  if (!UseFastLocking || UseHeavyMonitors) {
+    if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
+      // flag set to true on command line; warn the user that they
+      // can't enable biased locking here
+      warning("Biased Locking is not supported with locking debug flags"
+              "; ignoring UseBiasedLocking flag." );
+    }
+    UseBiasedLocking = false;
+  }
+
 #ifdef CC_INTERP
   // Clear flags not supported by the C++ interpreter
   FLAG_SET_DEFAULT(ProfileInterpreter, false);