src/share/vm/runtime/objectMonitor.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/objectMonitor.hpp

Print this page
rev 5732 : [mq]: comments2


  84     OM_TIMED_OUT              // Object.wait() timed out
  85   };
  86 
  87  public:
  88   // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ...
  89   // ByteSize would also be an appropriate type.
  90   static int header_offset_in_bytes()      { return offset_of(ObjectMonitor, _header);     }
  91   static int object_offset_in_bytes()      { return offset_of(ObjectMonitor, _object);     }
  92   static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner);      }
  93   static int count_offset_in_bytes()       { return offset_of(ObjectMonitor, _count);      }
  94   static int recursions_offset_in_bytes()  { return offset_of(ObjectMonitor, _recursions); }
  95   static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq) ;       }
  96   static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ) ;      }
  97   static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList);  }
  98   static int FreeNext_offset_in_bytes()    { return offset_of(ObjectMonitor, FreeNext);    }
  99   static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet) ;   }
 100   static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
 101   static int Spinner_offset_in_bytes()     { return offset_of(ObjectMonitor, _Spinner);    }
 102 
 103  public:
 104   // Eventaully we'll make provisions for multiple callbacks, but
 105   // now one will suffice.
 106   static int (*SpinCallbackFunction)(intptr_t, int) ;
 107   static intptr_t SpinCallbackArgument ;
 108 
 109 
 110  public:
 111   markOop   header() const;
 112   void      set_header(markOop hdr);
 113 
 114   intptr_t is_busy() const {
 115     // TODO-FIXME: merge _count and _waiters.
 116     // TODO-FIXME: assert _owner == null implies _recursions = 0
 117     // TODO-FIXME: assert _WaitSet != null implies _count > 0
 118     return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
 119   }
 120 
 121   intptr_t  is_entered(Thread* current) const;
 122 
 123   void*     owner() const;
 124   void      set_owner(void* owner);


 255   ObjectWaiter * volatile _cxq ;    // LL of recently-arrived threads blocked on entry.
 256                                     // The list is actually composed of WaitNodes, acting
 257                                     // as proxies for Threads.
 258  protected:
 259   ObjectWaiter * volatile _EntryList ;     // Threads blocked on entry or reentry.
 260  private:
 261   Thread * volatile _succ ;          // Heir presumptive thread - used for futile wakeup throttling
 262   Thread * volatile _Responsible ;
 263   int _PromptDrain ;                // rqst to drain cxq into EntryList ASAP
 264 
 265   volatile int _Spinner ;           // for exit->spinner handoff optimization
 266   volatile int _SpinFreq ;          // Spin 1-out-of-N attempts: success rate
 267   volatile int _SpinClock ;
 268   volatile int _SpinDuration ;
 269   volatile intptr_t _SpinState ;    // MCS/CLH list of spinners
 270 
 271   // TODO-FIXME: _count, _waiters and _recursions should be of
 272   // type int, or int32_t but not intptr_t.  There's no reason
 273   // to use 64-bit fields for these variables on a 64-bit JVM.
 274 
 275   volatile intptr_t  _count;        // reference count to prevent reclaimation/deflation
 276                                     // at stop-the-world time.  See deflate_idle_monitors().
 277                                     // _count is approximately |_WaitSet| + |_EntryList|
 278  protected:
 279   volatile intptr_t  _waiters;      // number of waiting threads
 280  private:
 281  protected:
 282   ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor
 283  private:
 284   volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
 285 
 286  public:
 287   int _QMix ;                       // Mixed prepend queue discipline
 288   ObjectMonitor * FreeNext ;        // Free list linkage
 289   intptr_t StatA, StatsB ;
 290 
 291  public:
 292   static void Initialize () ;
 293   static PerfCounter * _sync_ContendedLockAttempts ;
 294   static PerfCounter * _sync_FutileWakeups ;
 295   static PerfCounter * _sync_Parks ;




  84     OM_TIMED_OUT              // Object.wait() timed out
  85   };
  86 
  87  public:
  88   // TODO-FIXME: the "offset" routines should return a type of off_t instead of int ...
  89   // ByteSize would also be an appropriate type.
  90   static int header_offset_in_bytes()      { return offset_of(ObjectMonitor, _header);     }
  91   static int object_offset_in_bytes()      { return offset_of(ObjectMonitor, _object);     }
  92   static int owner_offset_in_bytes()       { return offset_of(ObjectMonitor, _owner);      }
  93   static int count_offset_in_bytes()       { return offset_of(ObjectMonitor, _count);      }
  94   static int recursions_offset_in_bytes()  { return offset_of(ObjectMonitor, _recursions); }
  95   static int cxq_offset_in_bytes()         { return offset_of(ObjectMonitor, _cxq) ;       }
  96   static int succ_offset_in_bytes()        { return offset_of(ObjectMonitor, _succ) ;      }
  97   static int EntryList_offset_in_bytes()   { return offset_of(ObjectMonitor, _EntryList);  }
  98   static int FreeNext_offset_in_bytes()    { return offset_of(ObjectMonitor, FreeNext);    }
  99   static int WaitSet_offset_in_bytes()     { return offset_of(ObjectMonitor, _WaitSet) ;   }
 100   static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible);}
 101   static int Spinner_offset_in_bytes()     { return offset_of(ObjectMonitor, _Spinner);    }
 102 
 103  public:
 104   // Eventually we'll make provisions for multiple callbacks, but
 105   // now one will suffice.
 106   static int (*SpinCallbackFunction)(intptr_t, int) ;
 107   static intptr_t SpinCallbackArgument ;
 108 
 109 
 110  public:
 111   markOop   header() const;
 112   void      set_header(markOop hdr);
 113 
 114   intptr_t is_busy() const {
 115     // TODO-FIXME: merge _count and _waiters.
 116     // TODO-FIXME: assert _owner == null implies _recursions = 0
 117     // TODO-FIXME: assert _WaitSet != null implies _count > 0
 118     return _count|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList ) ;
 119   }
 120 
 121   intptr_t  is_entered(Thread* current) const;
 122 
 123   void*     owner() const;
 124   void      set_owner(void* owner);


 255   ObjectWaiter * volatile _cxq ;    // LL of recently-arrived threads blocked on entry.
 256                                     // The list is actually composed of WaitNodes, acting
 257                                     // as proxies for Threads.
 258  protected:
 259   ObjectWaiter * volatile _EntryList ;     // Threads blocked on entry or reentry.
 260  private:
 261   Thread * volatile _succ ;          // Heir presumptive thread - used for futile wakeup throttling
 262   Thread * volatile _Responsible ;
 263   int _PromptDrain ;                // rqst to drain cxq into EntryList ASAP
 264 
 265   volatile int _Spinner ;           // for exit->spinner handoff optimization
 266   volatile int _SpinFreq ;          // Spin 1-out-of-N attempts: success rate
 267   volatile int _SpinClock ;
 268   volatile int _SpinDuration ;
 269   volatile intptr_t _SpinState ;    // MCS/CLH list of spinners
 270 
 271   // TODO-FIXME: _count, _waiters and _recursions should be of
 272   // type int, or int32_t but not intptr_t.  There's no reason
 273   // to use 64-bit fields for these variables on a 64-bit JVM.
 274 
 275   volatile intptr_t  _count;        // reference count to prevent reclamation/deflation
 276                                     // at stop-the-world time.  See deflate_idle_monitors().
 277                                     // _count is approximately |_WaitSet| + |_EntryList|
 278  protected:
 279   volatile intptr_t  _waiters;      // number of waiting threads
 280  private:
 281  protected:
 282   ObjectWaiter * volatile _WaitSet; // LL of threads wait()ing on the monitor
 283  private:
 284   volatile int _WaitSetLock;        // protects Wait Queue - simple spinlock
 285 
 286  public:
 287   int _QMix ;                       // Mixed prepend queue discipline
 288   ObjectMonitor * FreeNext ;        // Free list linkage
 289   intptr_t StatA, StatsB ;
 290 
 291  public:
 292   static void Initialize () ;
 293   static PerfCounter * _sync_ContendedLockAttempts ;
 294   static PerfCounter * _sync_FutileWakeups ;
 295   static PerfCounter * _sync_Parks ;


src/share/vm/runtime/objectMonitor.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File