Beispiel #1
0
 /**
  * Return the lock index for a given lock word. Assert valid index ranges, that the fat lock bit
  * is set, and that the lock entry exists.
  *
  * @param lockWord The lock word whose lock index is being established
  * @return the lock index corresponding to the lock workd.
  */
 @Inline
 @Uninterruptible
 public static int getLockIndex(Word lockWord) {
   int index = lockWord.and(TL_LOCK_ID_MASK).rshl(TL_LOCK_ID_SHIFT).toInt();
   if (VM.VerifyAssertions) {
     if (!(index > 0 && index < Lock.numLocks())) {
       VM.sysWrite("Lock index out of range! Word: ");
       VM.sysWrite(lockWord);
       VM.sysWrite(" index: ");
       VM.sysWrite(index);
       VM.sysWrite(" locks: ");
       VM.sysWrite(Lock.numLocks());
       VM.sysWriteln();
     }
     VM._assert(index > 0 && index < Lock.numLocks()); // index is in range
     VM._assert(lockWord.and(TL_STAT_MASK).EQ(TL_STAT_FAT)); // fat lock bit is set
   }
   return index;
 }