< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectMonitor.java

Print this page
*** 70,18 ***
  
    // FIXME: must implement and delegate to platform-dependent implementation
    //  public boolean isBusy();
    public boolean isEntered(sun.jvm.hotspot.runtime.Thread current) {
      Address o = owner();
!     if (current.threadObjectAddress().equals(o) ||
!         current.isLockOwned(o)) {
        return true;
      }
      return false;
    }
  
!   public Address owner() { return addr.getAddressAt(ownerFieldOffset); }
    // FIXME
    //  void      set_owner(void* owner);
  
    public int    waiters() { return (int)waitersField.getValue(this); }
  
--- 70,27 ---
  
    // FIXME: must implement and delegate to platform-dependent implementation
    //  public boolean isBusy();
    public boolean isEntered(sun.jvm.hotspot.runtime.Thread current) {
      Address o = owner();
!     if (o.asLongValue() == 1) throw new InternalError("Check anonymous owner before calling isEntered()");
!     if (current.threadObjectAddress().equals(o)) {
        return true;
      }
      return false;
    }
  
!   public boolean isOwnedAnonymous() {
+     return addr.getAddressAt(ownerFieldOffset).asLongValue() == 1;
+   }
+ 
+   public Address owner() {
+     Address owner = addr.getAddressAt(ownerFieldOffset);
+     if (owner.asLongValue() == 1) throw new InternalError("Check anonymous owner before calling isEntered()");
+     return owner;
+   }
+ 
    // FIXME
    //  void      set_owner(void* owner);
  
    public int    waiters() { return (int)waitersField.getValue(this); }
  
< prev index next >