8202615: Remove NativeMonitorSpinLimit, NativeMonitorFlags and NativeMonitorTimeout experimental flags
authorcoleenp
Mon, 25 Jun 2018 13:47:27 -0400
changeset 50765 c49a01150a66
parent 50764 5637aca18f1d
child 50766 759f63d8a9fe
8202615: Remove NativeMonitorSpinLimit, NativeMonitorFlags and NativeMonitorTimeout experimental flags Summary: Removed NativeMonitorSpinLimit, NativeMonitorFlags and NativeMonitorTimeout experimental flags from globals.hpp and mutex.cpp and marked them as obsolete. Reviewed-by: kbarrett, dholmes Contributed-by: patricio.chilano.mateo@oracle.com
src/hotspot/share/runtime/arguments.cpp
src/hotspot/share/runtime/globals.hpp
src/hotspot/share/runtime/mutex.cpp
--- a/src/hotspot/share/runtime/arguments.cpp	Mon Jun 25 09:59:16 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Mon Jun 25 13:47:27 2018 -0400
@@ -570,6 +570,9 @@
   { "InlineNotify",                  JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "EnableTracing",                 JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "UseLockedTracing",              JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "NativeMonitorTimeout",          JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "NativeMonitorSpinLimit",        JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "NativeMonitorFlags",            JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
--- a/src/hotspot/share/runtime/globals.hpp	Mon Jun 25 09:59:16 2018 -0700
+++ b/src/hotspot/share/runtime/globals.hpp	Mon Jun 25 13:47:27 2018 -0400
@@ -854,12 +854,6 @@
           "When true prevents OS-level spurious, or premature, wakeups "    \
           "from Object.wait (Ignored for Windows)")                         \
                                                                             \
-  experimental(intx, NativeMonitorTimeout, -1, "(Unstable)")                \
-                                                                            \
-  experimental(intx, NativeMonitorFlags, 0, "(Unstable)")                   \
-                                                                            \
-  experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)")              \
-                                                                            \
   develop(bool, UsePthreads, false,                                         \
           "Use pthread-based instead of libthread-based synchronization "   \
           "(SPARC only)")                                                   \
--- a/src/hotspot/share/runtime/mutex.cpp	Mon Jun 25 09:59:16 2018 -0700
+++ b/src/hotspot/share/runtime/mutex.cpp	Mon Jun 25 13:47:27 2018 -0400
@@ -348,9 +348,7 @@
 
   int Probes  = 0;
   int Delay   = 0;
-  int Steps   = 0;
-  int SpinMax = NativeMonitorSpinLimit;
-  int flgs    = NativeMonitorFlags;
+  int SpinMax = 20;
   for (;;) {
     intptr_t v = _LockWord.FullWord;
     if ((v & _LBIT) == 0) {
@@ -360,9 +358,7 @@
       continue;
     }
 
-    if ((flgs & 8) == 0) {
-      SpinPause();
-    }
+    SpinPause();
 
     // Periodically increase Delay -- variable Delay form
     // conceptually: delay *= 1 + 1/Exponent
@@ -374,8 +370,6 @@
       // CONSIDER: Delay += 1 + (Delay/4); Delay &= 0x7FF ;
     }
 
-    if (flgs & 2) continue;
-
     // Consider checking _owner's schedctl state, if OFFPROC abort spin.
     // If the owner is OFFPROC then it's unlike that the lock will be dropped
     // in a timely fashion, which suggests that spinning would not be fruitful
@@ -390,12 +384,11 @@
     // spin loop.  N1 and brethren write-around the L1$ over the xbar into the L2$.
     // Furthermore, they don't have a W$ like traditional SPARC processors.
     // We currently use a Marsaglia Shift-Xor RNG loop.
-    Steps += Delay;
     if (Self != NULL) {
       jint rv = Self->rng[0];
       for (int k = Delay; --k >= 0;) {
         rv = MarsagliaXORV(rv);
-        if ((flgs & 4) == 0 && SafepointMechanism::poll(Self)) return 0;
+        if (SafepointMechanism::poll(Self)) return 0;
       }
       Self->rng[0] = rv;
     } else {
@@ -406,10 +399,6 @@
 
 static int ParkCommon(ParkEvent * ev, jlong timo) {
   // Diagnostic support - periodically unwedge blocked threads
-  intx nmt = NativeMonitorTimeout;
-  if (nmt > 0 && (nmt < timo || timo <= 0)) {
-    timo = nmt;
-  }
   int err = OS_OK;
   if (0 == timo) {
     ev->park();
@@ -466,11 +455,6 @@
   ESelf->reset();
   OrderAccess::fence();
 
-  // Optional optimization ... try barging on the inner lock
-  if ((NativeMonitorFlags & 32) && Atomic::replace_if_null(ESelf, &_OnDeck)) {
-    goto OnDeck_LOOP;
-  }
-
   if (AcquireOrPush(ESelf)) goto Exeunt;
 
   // At any given time there is at most one ondeck thread.
@@ -484,7 +468,6 @@
 
   // Self is now in the OnDeck position and will remain so until it
   // manages to acquire the lock.
- OnDeck_LOOP:
   for (;;) {
     assert(_OnDeck == ESelf, "invariant");
     if (TrySpin(Self)) break;
@@ -706,11 +689,6 @@
     nfy->Notified = 1;
   }
   Thread::muxRelease(_WaitLock);
-  if (nfy != NULL && (NativeMonitorFlags & 16)) {
-    // Experimental code ... light up the wakee in the hope that this thread (the owner)
-    // will drop the lock just about the time the wakee comes ONPROC.
-    nfy->unpark();
-  }
   assert(ILocked(), "invariant");
   return true;
 }
@@ -794,7 +772,7 @@
   for (;;) {
     if (ESelf->Notified) break;
     int err = ParkCommon(ESelf, timo);
-    if (err == OS_TIMEOUT || (NativeMonitorFlags & 1)) break;
+    if (err == OS_TIMEOUT) break;
   }
 
   // Prepare for reentry - if necessary, remove ESelf from WaitSet