--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp Fri Jun 13 19:07:11 2014 -0700
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp Tue Jun 17 12:54:01 2014 -0700
@@ -37,17 +37,17 @@
class ObjectWaiter : public StackObj {
public:
- enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ } ;
- enum Sorted { PREPEND, APPEND, SORTED } ;
+ enum TStates { TS_UNDEF, TS_READY, TS_RUN, TS_WAIT, TS_ENTER, TS_CXQ };
+ enum Sorted { PREPEND, APPEND, SORTED };
ObjectWaiter * volatile _next;
ObjectWaiter * volatile _prev;
Thread* _thread;
jlong _notifier_tid;
ParkEvent * _event;
- volatile int _notified ;
- volatile TStates TState ;
- Sorted _Sorted ; // List placement disposition
- bool _active ; // Contention monitoring is enabled
+ volatile int _notified;
+ volatile TStates TState;
+ Sorted _Sorted; // List placement disposition
+ bool _active; // Contention monitoring is enabled
public:
ObjectWaiter(Thread* thread);
@@ -92,19 +92,19 @@
static int owner_offset_in_bytes() { return offset_of(ObjectMonitor, _owner); }
static int count_offset_in_bytes() { return offset_of(ObjectMonitor, _count); }
static int recursions_offset_in_bytes() { return offset_of(ObjectMonitor, _recursions); }
- static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq) ; }
- static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ) ; }
+ static int cxq_offset_in_bytes() { return offset_of(ObjectMonitor, _cxq); }
+ static int succ_offset_in_bytes() { return offset_of(ObjectMonitor, _succ); }
static int EntryList_offset_in_bytes() { return offset_of(ObjectMonitor, _EntryList); }
static int FreeNext_offset_in_bytes() { return offset_of(ObjectMonitor, FreeNext); }
- static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet) ; }
- static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
+ static int WaitSet_offset_in_bytes() { return offset_of(ObjectMonitor, _WaitSet); }
+ static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
static int Spinner_offset_in_bytes() { return offset_of(ObjectMonitor, _Spinner); }
public:
// Eventually we'll make provisions for multiple callbacks, but
// now one will suffice.
- static int (*SpinCallbackFunction)(intptr_t, int) ;
- static intptr_t SpinCallbackArgument ;
+ static int (*SpinCallbackFunction)(intptr_t, int);
+ static intptr_t SpinCallbackArgument;
public:
@@ -115,7 +115,7 @@
// TODO-FIXME: merge _count and _waiters.
// TODO-FIXME: assert _owner == null implies _recursions = 0
// TODO-FIXME: assert _WaitSet != null implies _count > 0
- return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
+ return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
}
intptr_t is_entered(Thread* current) const;
@@ -127,7 +127,7 @@
intptr_t count() const;
void set_count(intptr_t count);
- intptr_t contentions() const ;
+ intptr_t contentions() const;
intptr_t recursions() const { return _recursions; }
// JVM/DI GetMonitorInfo() needs this
@@ -145,15 +145,15 @@
_object = NULL;
_owner = NULL;
_WaitSet = NULL;
- _WaitSetLock = 0 ;
- _Responsible = NULL ;
- _succ = NULL ;
- _cxq = NULL ;
- FreeNext = NULL ;
- _EntryList = NULL ;
- _SpinFreq = 0 ;
- _SpinClock = 0 ;
- OwnerIsThread = 0 ;
+ _WaitSetLock = 0;
+ _Responsible = NULL;
+ _succ = NULL;
+ _cxq = NULL;
+ FreeNext = NULL;
+ _EntryList = NULL;
+ _SpinFreq = 0;
+ _SpinClock = 0;
+ OwnerIsThread = 0;
_previous_owner_tid = 0;
}
@@ -164,20 +164,20 @@
}
private:
- void Recycle () {
+ void Recycle() {
// TODO: add stronger asserts ...
// _cxq == 0 _succ == NULL _owner == NULL _waiters == 0
// _count == 0 EntryList == NULL
// _recursions == 0 _WaitSet == NULL
// TODO: assert (is_busy()|_recursions) == 0
- _succ = NULL ;
- _EntryList = NULL ;
- _cxq = NULL ;
- _WaitSet = NULL ;
- _recursions = 0 ;
- _SpinFreq = 0 ;
- _SpinClock = 0 ;
- OwnerIsThread = 0 ;
+ _succ = NULL;
+ _EntryList = NULL;
+ _cxq = NULL;
+ _WaitSet = NULL;
+ _recursions = 0;
+ _SpinFreq = 0;
+ _SpinClock = 0;
+ OwnerIsThread = 0;
}
public:
@@ -194,7 +194,7 @@
void print();
#endif
- bool try_enter (TRAPS) ;
+ bool try_enter(TRAPS);
void enter(TRAPS);
void exit(bool not_suspended, TRAPS);
void wait(jlong millis, bool interruptable, TRAPS);
@@ -206,22 +206,22 @@
void reenter(intptr_t recursions, TRAPS);
private:
- void AddWaiter (ObjectWaiter * waiter) ;
+ void AddWaiter(ObjectWaiter * waiter);
static void DeferredInitialize();
- ObjectWaiter * DequeueWaiter () ;
- void DequeueSpecificWaiter (ObjectWaiter * waiter) ;
- void EnterI (TRAPS) ;
- void ReenterI (Thread * Self, ObjectWaiter * SelfNode) ;
- void UnlinkAfterAcquire (Thread * Self, ObjectWaiter * SelfNode) ;
- int TryLock (Thread * Self) ;
- int NotRunnable (Thread * Self, Thread * Owner) ;
- int TrySpin_Fixed (Thread * Self) ;
- int TrySpin_VaryFrequency (Thread * Self) ;
- int TrySpin_VaryDuration (Thread * Self) ;
- void ctAsserts () ;
- void ExitEpilog (Thread * Self, ObjectWaiter * Wakee) ;
- bool ExitSuspendEquivalent (JavaThread * Self) ;
+ ObjectWaiter * DequeueWaiter();
+ void DequeueSpecificWaiter(ObjectWaiter * waiter);
+ void EnterI(TRAPS);
+ void ReenterI(Thread * Self, ObjectWaiter * SelfNode);
+ void UnlinkAfterAcquire(Thread * Self, ObjectWaiter * SelfNode);
+ int TryLock(Thread * Self);
+ int NotRunnable(Thread * Self, Thread * Owner);
+ int TrySpin_Fixed(Thread * Self);
+ int TrySpin_VaryFrequency(Thread * Self);
+ int TrySpin_VaryDuration(Thread * Self);
+ void ctAsserts();
+ void ExitEpilog(Thread * Self, ObjectWaiter * Wakee);
+ bool ExitSuspendEquivalent(JavaThread * Self);
void post_monitor_wait_event(EventJavaMonitorWait * event,
jlong notifier_tid,
jlong timeout,
@@ -240,7 +240,7 @@
volatile markOop _header; // displaced object header word - mark
void* volatile _object; // backward object pointer - strong root
- double SharingPad [1] ; // temp to reduce false sharing
+ double SharingPad[1]; // temp to reduce false sharing
// All the following fields must be machine word aligned
// The VM assumes write ordering wrt these fields, which can be
@@ -251,22 +251,22 @@
volatile jlong _previous_owner_tid; // thread id of the previous owner of the monitor
volatile intptr_t _recursions; // recursion count, 0 for first entry
private:
- int OwnerIsThread ; // _owner is (Thread *) vs SP/BasicLock
- ObjectWaiter * volatile _cxq ; // LL of recently-arrived threads blocked on entry.
+ int OwnerIsThread; // _owner is (Thread *) vs SP/BasicLock
+ ObjectWaiter * volatile _cxq; // LL of recently-arrived threads blocked on entry.
// The list is actually composed of WaitNodes, acting
// as proxies for Threads.
protected:
- ObjectWaiter * volatile _EntryList ; // Threads blocked on entry or reentry.
+ ObjectWaiter * volatile _EntryList; // Threads blocked on entry or reentry.
private:
- Thread * volatile _succ ; // Heir presumptive thread - used for futile wakeup throttling
- Thread * volatile _Responsible ;
- int _PromptDrain ; // rqst to drain cxq into EntryList ASAP
+ Thread * volatile _succ; // Heir presumptive thread - used for futile wakeup throttling
+ Thread * volatile _Responsible;
+ int _PromptDrain; // rqst to drain cxq into EntryList ASAP
- volatile int _Spinner ; // for exit->spinner handoff optimization
- volatile int _SpinFreq ; // Spin 1-out-of-N attempts: success rate
- volatile int _SpinClock ;
- volatile int _SpinDuration ;
- volatile intptr_t _SpinState ; // MCS/CLH list of spinners
+ volatile int _Spinner; // for exit->spinner handoff optimization
+ volatile int _SpinFreq; // Spin 1-out-of-N attempts: success rate
+ volatile int _SpinClock;
+ volatile int _SpinDuration;
+ volatile intptr_t _SpinState; // MCS/CLH list of spinners
// TODO-FIXME: _count, _waiters and _recursions should be of
// type int, or int32_t but not intptr_t. There's no reason
@@ -284,30 +284,30 @@
volatile int _WaitSetLock; // protects Wait Queue - simple spinlock
public:
- int _QMix ; // Mixed prepend queue discipline
- ObjectMonitor * FreeNext ; // Free list linkage
- intptr_t StatA, StatsB ;
+ int _QMix; // Mixed prepend queue discipline
+ ObjectMonitor * FreeNext; // Free list linkage
+ intptr_t StatA, StatsB;
public:
- static void Initialize () ;
- static PerfCounter * _sync_ContendedLockAttempts ;
- static PerfCounter * _sync_FutileWakeups ;
- static PerfCounter * _sync_Parks ;
- static PerfCounter * _sync_EmptyNotifications ;
- static PerfCounter * _sync_Notifications ;
- static PerfCounter * _sync_SlowEnter ;
- static PerfCounter * _sync_SlowExit ;
- static PerfCounter * _sync_SlowNotify ;
- static PerfCounter * _sync_SlowNotifyAll ;
- static PerfCounter * _sync_FailedSpins ;
- static PerfCounter * _sync_SuccessfulSpins ;
- static PerfCounter * _sync_PrivateA ;
- static PerfCounter * _sync_PrivateB ;
- static PerfCounter * _sync_MonInCirculation ;
- static PerfCounter * _sync_MonScavenged ;
- static PerfCounter * _sync_Inflations ;
- static PerfCounter * _sync_Deflations ;
- static PerfLongVariable * _sync_MonExtant ;
+ static void Initialize();
+ static PerfCounter * _sync_ContendedLockAttempts;
+ static PerfCounter * _sync_FutileWakeups;
+ static PerfCounter * _sync_Parks;
+ static PerfCounter * _sync_EmptyNotifications;
+ static PerfCounter * _sync_Notifications;
+ static PerfCounter * _sync_SlowEnter;
+ static PerfCounter * _sync_SlowExit;
+ static PerfCounter * _sync_SlowNotify;
+ static PerfCounter * _sync_SlowNotifyAll;
+ static PerfCounter * _sync_FailedSpins;
+ static PerfCounter * _sync_SuccessfulSpins;
+ static PerfCounter * _sync_PrivateA;
+ static PerfCounter * _sync_PrivateB;
+ static PerfCounter * _sync_MonInCirculation;
+ static PerfCounter * _sync_MonScavenged;
+ static PerfCounter * _sync_Inflations;
+ static PerfCounter * _sync_Deflations;
+ static PerfLongVariable * _sync_MonExtant;
public:
static int Knob_Verbose;
@@ -329,7 +329,7 @@
#undef TEVENT
#define TEVENT(nom) {if (SyncVerbose) FEVENT(nom); }
-#define FEVENT(nom) { static volatile int ctr = 0 ; int v = ++ctr ; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
+#define FEVENT(nom) { static volatile int ctr = 0; int v = ++ctr; if ((v & (v-1)) == 0) { ::printf (#nom " : %d \n", v); ::fflush(stdout); }}
#undef TEVENT
#define TEVENT(nom) {;}