src/hotspot/share/runtime/mutex.cpp
changeset 50765 c49a01150a66
parent 50429 83aec1d357d4
child 51376 181e6a03249b
--- 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