< prev index next >

src/hotspot/share/runtime/objectMonitor.inline.hpp

Print this page
*** 28,18 ***
  #include "runtime/objectMonitor.hpp"
  
  #include "logging/log.hpp"
  #include "oops/access.inline.hpp"
  #include "runtime/atomic.hpp"
  #include "runtime/synchronizer.hpp"
  
! inline intptr_t ObjectMonitor::is_entered(JavaThread* current) const {
!   void* owner = owner_raw();
!   if (current == owner || current->is_lock_owned((address)owner)) {
!     return 1;
    }
!   return 0;
  }
  
  inline markWord ObjectMonitor::header() const {
    return Atomic::load(&_header);
  }
--- 28,27 ---
  #include "runtime/objectMonitor.hpp"
  
  #include "logging/log.hpp"
  #include "oops/access.inline.hpp"
  #include "runtime/atomic.hpp"
+ #include "runtime/lockStack.inline.hpp"
  #include "runtime/synchronizer.hpp"
  
! inline bool ObjectMonitor::is_entered(JavaThread* current) const {
!   if (LockingMode == LM_LIGHTWEIGHT) {
!     if (is_owner_anonymous()) {
!       return current->lock_stack().contains(object());
+     } else {
+       return current == owner_raw();
+     }
+   } else {
+     void* owner = owner_raw();
+     if (current == owner || current->is_lock_owned((address)owner)) {
+       return true;
+     }
    }
!   return false;
  }
  
  inline markWord ObjectMonitor::header() const {
    return Atomic::load(&_header);
  }

*** 54,10 ***
--- 63,15 ---
  
  inline jint ObjectMonitor::waiters() const {
    return _waiters;
  }
  
+ inline bool ObjectMonitor::has_owner() const {
+   void* owner = owner_raw();
+   return owner != NULL && owner != DEFLATER_MARKER;
+ }
+ 
  // Returns NULL if DEFLATER_MARKER is observed.
  inline void* ObjectMonitor::owner() const {
    void* owner = owner_raw();
    return owner != DEFLATER_MARKER ? owner : NULL;
  }
< prev index next >