< prev index next >

src/hotspot/share/runtime/objectMonitor.hpp

Print this page
rev 55489 : Checkpoint latest preliminary review patches for full OpenJDK review; merge with 8222295.patch.
rev 55490 : imported patch dcubed.monitor_deflate_conc.v2.01
rev 55492 : imported patch dcubed.monitor_deflate_conc.v2.03
rev 55494 : imported patch dcubed.monitor_deflate_conc.v2.05


 232   //
 233   // We can either adjust the ObjectMonitor reference and then add the
 234   // offset or we can adjust the offset that is added to the ObjectMonitor
 235   // reference. The latter avoids an AGI (Address Generation Interlock)
 236   // stall so the helper macro adjusts the offset value that is returned
 237   // to the ObjectMonitor reference manipulation code:
 238   //
 239   #define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
 240     ((ObjectMonitor::f ## _offset_in_bytes()) - markOopDesc::monitor_value)
 241 
 242   markOop   header() const;
 243   volatile markOop* header_addr();
 244   void      set_header(markOop hdr);
 245 
 246   intptr_t is_busy() const {
 247     // TODO-FIXME: assert _owner == null implies _recursions = 0
 248     // We do not include _ref_count in the is_busy() check because
 249     // _ref_count is for indicating that the ObjectMonitor* is in
 250     // use which is orthogonal to whether the ObjectMonitor itself
 251     // is in use for a locking operation.
 252     return _contentions|_waiters|intptr_t(_owner)|intptr_t(_cxq)|intptr_t(_EntryList);
 253   }
 254   const char* is_busy_to_string(stringStream* ss);
 255 
 256   // Version of is_busy() that accounts for the special value in
 257   // _owner when AsyncDeflateIdleMonitors is enabled.
 258   intptr_t is_busy_async() const {
 259     intptr_t ret_code = _contentions | _waiters | intptr_t(_cxq) | intptr_t(_EntryList);
 260     if (!AsyncDeflateIdleMonitors) {
 261       ret_code |= intptr_t(_owner);
 262     } else {
 263       if (_owner != DEFLATER_MARKER) {
 264         ret_code |= intptr_t(_owner);
 265       }
 266     }
 267     return ret_code;
 268   }

 269 
 270   intptr_t  is_entered(Thread* current) const;
 271 
 272   void*     owner() const;  // Returns NULL if DEFLATER_MARKER is observed.


 273   void      set_owner(void* owner);
 274 
 275   jint      waiters() const;
 276 
 277   jint      contentions() const;
 278   intptr_t  recursions() const                                         { return _recursions; }
 279 
 280   // JVM/TI GetObjectMonitorUsage() needs this:
 281   ObjectWaiter* first_waiter()                                         { return _WaitSet; }
 282   ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
 283   Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
 284 
 285  protected:
 286   // We don't typically expect or want the ctors or dtors to run.
 287   // normal ObjectMonitors are type-stable and immortal.
 288   ObjectMonitor() { ::memset((void *)this, 0, sizeof(*this)); }
 289 
 290   ~ObjectMonitor() {
 291     // TODO: Add asserts ...
 292     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0




 232   //
 233   // We can either adjust the ObjectMonitor reference and then add the
 234   // offset or we can adjust the offset that is added to the ObjectMonitor
 235   // reference. The latter avoids an AGI (Address Generation Interlock)
 236   // stall so the helper macro adjusts the offset value that is returned
 237   // to the ObjectMonitor reference manipulation code:
 238   //
 239   #define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
 240     ((ObjectMonitor::f ## _offset_in_bytes()) - markOopDesc::monitor_value)
 241 
 242   markOop   header() const;
 243   volatile markOop* header_addr();
 244   void      set_header(markOop hdr);
 245 
 246   intptr_t is_busy() const {
 247     // TODO-FIXME: assert _owner == null implies _recursions = 0
 248     // We do not include _ref_count in the is_busy() check because
 249     // _ref_count is for indicating that the ObjectMonitor* is in
 250     // use which is orthogonal to whether the ObjectMonitor itself
 251     // is in use for a locking operation.







 252     intptr_t ret_code = _contentions | _waiters | intptr_t(_cxq) | intptr_t(_EntryList);
 253     if (!AsyncDeflateIdleMonitors) {
 254       ret_code |= intptr_t(_owner);
 255     } else {
 256       if (_owner != DEFLATER_MARKER) {
 257         ret_code |= intptr_t(_owner);
 258       }
 259     }
 260     return ret_code;
 261   }
 262   const char* is_busy_to_string(stringStream* ss);
 263 
 264   intptr_t  is_entered(Thread* current) const;
 265 
 266   void*     owner() const;  // Returns NULL if DEFLATER_MARKER is observed.
 267   // Returns true if owner field == DEFLATER_MARKER and false otherwise.
 268   bool      owner_is_DEFLATER_MARKER();
 269   void      set_owner(void* owner);
 270 
 271   jint      waiters() const;
 272 
 273   jint      contentions() const;
 274   intptr_t  recursions() const                                         { return _recursions; }
 275 
 276   // JVM/TI GetObjectMonitorUsage() needs this:
 277   ObjectWaiter* first_waiter()                                         { return _WaitSet; }
 278   ObjectWaiter* next_waiter(ObjectWaiter* o)                           { return o->_next; }
 279   Thread* thread_of_waiter(ObjectWaiter* o)                            { return o->_thread; }
 280 
 281  protected:
 282   // We don't typically expect or want the ctors or dtors to run.
 283   // normal ObjectMonitors are type-stable and immortal.
 284   ObjectMonitor() { ::memset((void *)this, 0, sizeof(*this)); }
 285 
 286   ~ObjectMonitor() {
 287     // TODO: Add asserts ...
 288     // _cxq == 0 _succ == NULL _owner == NULL _waiters == 0


< prev index next >