/**
  * Debugging routine: returns the index (0..top() - 1) of the handle in this block, or -1 if the
  * handle was not contained in this block. Does not search successor blocks.
  */
 public int indexOfHandle(Address jniHandle) {
   for (int i = 0; i < top(); i++) {
     Address addr = getOopHandleAddress(i);
     if (addr != null) {
       if (addr.equals(jniHandle)) {
         return i;
       }
     }
   }
   return -1;
 }
Beispiel #2
0
  // refer to Threads::owning_thread_from_monitor_owner
  public JavaThread owningThreadFromMonitor(Address o) {
    if (o == null) return null;
    for (JavaThread thread = first(); thread != null; thread = thread.next()) {
      if (o.equals(thread.threadObjectAddress())) {
        return thread;
      }
    }

    for (JavaThread thread = first(); thread != null; thread = thread.next()) {
      if (thread.isLockOwned(o)) return thread;
    }
    return null;
  }