getThreadState(VM_Thread t) {   for (int i = 0; i < VM_Scheduler.processors.length; ++i) { VM_Processor p = VM_Scheduler.processors[i]; if (p == null) continue; if (p.transferQueue.contains(t)) return "runnable (incoming) on processor " + i; if (p.readyQueue.contains(t))    return "runnable on processor " + i; if (p.ioQueue.contains(t))       return "waitingForIO (fd=" + t.waitFdRead + " ready=" + t.waitFdReady + ") on processor " + i; if (p.idleQueue.contains(t))     return "waitingForIdleWork on processor " + i; }
private static String getThreadState(VM_Thread t) {   for (int i = 0; i < VM_Scheduler.processors.length; ++i) { VM_Processor p = VM_Scheduler.processors[i]; if (p == null) continue; if (p.transferQueue.contains(t)) return "runnable (incoming) on processor " + i; if (p.readyQueue.contains(t))    return "runnable on processor " + i; if (p.ioQueue.contains(t))       return "waitingForIO (fd=" + t.waitFdRead + " ready=" + t.waitFdReady + ") on processor " + i; if (p.idleQueue.contains(t))     return "waitingForIdleWork on processor " + i; }
   getThreadState(VM_Thread t)      {      // scan per-processor queues      //      for (int i = 0; i < VM_Scheduler.processors.length; ++i)         {         VM_Processor p = VM_Scheduler.processors[i];         if (p == null) continue;         if (p.transferQueue.contains(t)) return "runnable (incoming) on processor " + i;         if (p.readyQueue.contains(t))    return "runnable on processor " + i;         if (p.ioQueue.contains(t))       return "waitingForIO (fd=" + t.waitFdRead + " ready=" + t.waitFdReady + ") on processor " + i;         if (p.idleQueue.contains(t))     return "waitingForIdleWork on processor " + i;         }               // scan global queues      //      if (VM_Scheduler.wakeupQueue.contains(t))    return "sleeping";      if (VM_Scheduler.debuggerQueue.contains(t))  return "waitingForDebuggerWork";      if (VM_Scheduler.gcWaitQueue.contains(t))    return "waitingForCollectorWork";      if (VM_Scheduler.collectorQueue.contains(t)) return "waitingForCollectorWork";      if (VM_Scheduler.deadQueue.contains(t))      return "waitingToBeReaped";            // scan lock queues      //      for (int i = 0; i < VM_Scheduler.locks.length; ++i)         {         VM_Lock l = VM_Scheduler.locks[i];         if (l == null || !l.active) continue;         if (l.entering.contains(t)) return "waitingForLock";         if (l.waiting.contains(t))  return "waitingForNotification";         }      // not in any queue      //      for (int i = 0; i < VM_Scheduler.processors.length; ++i)         {         VM_Processor p = VM_Scheduler.processors[i];         if (p == null) continue;         if (p.activeThread == t)            return "running on processor " + i;         }      return "unknown";      }