< prev index next >

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

Print this page

 55     contentionsField  = new CIntField(type.getCIntegerField("_contentions"), 0);
 56     waitersField      = new CIntField(type.getCIntegerField("_waiters"), 0);
 57     recursionsField   = type.getCIntegerField("_recursions");
 58   }
 59 
 60   public ObjectMonitor(Address addr) {
 61     super(addr);
 62   }
 63 
 64   public Mark header() {
 65     return new Mark(addr.addOffsetTo(headerFieldOffset));
 66   }
 67 
 68   // FIXME
 69   //  void      set_header(markWord hdr);
 70 
 71   // FIXME: must implement and delegate to platform-dependent implementation
 72   //  public boolean isBusy();
 73   public boolean isEntered(sun.jvm.hotspot.runtime.Thread current) {
 74     Address o = owner();
 75     if (current.threadObjectAddress().equals(o) ||
 76         current.isLockOwned(o)) {
 77       return true;
 78     }
 79     return false;
 80   }
 81 
 82   public Address owner() { return addr.getAddressAt(ownerFieldOffset); }









 83   // FIXME
 84   //  void      set_owner(void* owner);
 85 
 86   public int    waiters() { return (int)waitersField.getValue(this); }
 87 
 88   public Address nextOM() { return addr.getAddressAt(nextOMFieldOffset); }
 89   // FIXME
 90   //  void      set_queue(void* owner);
 91 
 92   public long recursions() { return recursionsField.getValue(addr); }
 93 
 94   public OopHandle object() {
 95     Address objAddr = addr.getAddressAt(objectFieldOffset);
 96     if (objAddr == null) {
 97       return null;
 98     }
 99     return objAddr.getOopHandleAt(0);
100   }
101 
102   public int contentions() {

 55     contentionsField  = new CIntField(type.getCIntegerField("_contentions"), 0);
 56     waitersField      = new CIntField(type.getCIntegerField("_waiters"), 0);
 57     recursionsField   = type.getCIntegerField("_recursions");
 58   }
 59 
 60   public ObjectMonitor(Address addr) {
 61     super(addr);
 62   }
 63 
 64   public Mark header() {
 65     return new Mark(addr.addOffsetTo(headerFieldOffset));
 66   }
 67 
 68   // FIXME
 69   //  void      set_header(markWord hdr);
 70 
 71   // FIXME: must implement and delegate to platform-dependent implementation
 72   //  public boolean isBusy();
 73   public boolean isEntered(sun.jvm.hotspot.runtime.Thread current) {
 74     Address o = owner();
 75     if (o.asLongValue() == 1) throw new InternalError("Check anonymous owner before calling isEntered()");
 76     if (current.threadObjectAddress().equals(o)) {
 77       return true;
 78     }
 79     return false;
 80   }
 81 
 82   public boolean isOwnedAnonymous() {
 83     return addr.getAddressAt(ownerFieldOffset).asLongValue() == 1;
 84   }
 85 
 86   public Address owner() {
 87     Address owner = addr.getAddressAt(ownerFieldOffset);
 88     if (owner.asLongValue() == 1) throw new InternalError("Check anonymous owner before calling isEntered()");
 89     return owner;
 90   }
 91 
 92   // FIXME
 93   //  void      set_owner(void* owner);
 94 
 95   public int    waiters() { return (int)waitersField.getValue(this); }
 96 
 97   public Address nextOM() { return addr.getAddressAt(nextOMFieldOffset); }
 98   // FIXME
 99   //  void      set_queue(void* owner);
100 
101   public long recursions() { return recursionsField.getValue(addr); }
102 
103   public OopHandle object() {
104     Address objAddr = addr.getAddressAt(objectFieldOffset);
105     if (objAddr == null) {
106       return null;
107     }
108     return objAddr.getOopHandleAt(0);
109   }
110 
111   public int contentions() {
< prev index next >