VM.sysWrite(o.getClass().toString());
VM.sysWrite(VM_Magic.getObjectType(o).getDescriptor());
  static void lock (Object o, int lockOffset) {    VM_Magic.pragmaNoInline();    if (VM.BuildForEventLogging && VM.EventLoggingEnabled) { VM_EventLogger.logOtherLockContentionEvent(); }major: while (true) { // repeat only if attempt to lock a promoted lock fails         int retries = retryLimit; minor:  while (0 != retries--) { // repeat if there is contention for thin lock          int old = VM_Magic.prepare(o, lockOffset);          int id = old & (TL_THREAD_ID_MASK | TL_FAT_LOCK_MASK);          if (id == 0) { // o isn't locked            if (VM_Magic.attempt(o, lockOffset, old, old | VM_Magic.getThreadId())) {              VM_Magic.isync(); // don't use stale prefetched data in monitor              if (STATS) slowLocks++;              break major;  // lock succeeds            }            continue minor; // contention, possibly spurious, try again          }          if (id == VM_Magic.getThreadId()) { // this thread has o locked already            int changed = old + TL_LOCK_COUNT_UNIT; // update count            if ((changed & TL_LOCK_COUNT_MASK) == 0) { // count wrapped around (most unlikely), make heavy lock              while (!inflateAndLock(o, lockOffset)) { // wait for a lock to become available                if (VM_Processor.getCurrentProcessor().threadSwitchingEnabled())                  VM_Thread.yield();;              }              break major;  // lock succeeds (note that lockHeavy has issued an isync)            }            if (VM_Magic.attempt(o, lockOffset, old, changed)) {              VM_Magic.isync(); // don't use stale prefetched data in monitor !!TODO: is this isync required?              if (STATS) slowLocks++;              break major;  // lock succeeds            }            continue minor; // contention, probably spurious, try again (TODO!! worry about this)          }          if ((old & TL_FAT_LOCK_MASK) != 0) { // o has a heavy lock            int index = old & TL_LOCK_ID_MASK;            index >>>= TL_LOCK_ID_SHIFT;            if (VM.VerifyAssertions) {              if (index >= VM_Scheduler.locks.length) {                VM.sysWrite("Error in VM_ThinLock.lock:\n");                VM.sysWrite("  VM_Scheduler.locks.length: ");                VM.sysWrite(VM_Scheduler.locks.length,false);                VM.sysWrite("\n");                VM.sysWrite("  index: ");                VM.sysWrite(index,false);                VM.sysWrite("\n");                VM.sysWrite("  old status word: ");                VM.sysWrite(index,true);                VM.sysWrite("\n");                VM.sysWrite("  Object class: ");                VM.sysWrite(o.getClass().toString());                VM.sysWrite("\n");              }            }            if (VM_Scheduler.locks[index].lockHeavy(o)) {              break major; // lock succeeds (note that lockHeavy has issued an isync)            }            // heavy lock failed (deflated or contention for system lock)            if (VM_Processor.getCurrentProcessor().threadSwitchingEnabled()) {              VM_Thread.yield(); // wait, hope o gets unlocked            }            continue major;    // try again          }          // real contention: wait (hope other thread unlocks o), try again          if (traceContention) { // for performance tuning only (see section 5)	    VM_Address fp = VM_Magic.getFramePointer();            fp = VM_Magic.getCallerFramePointer(fp);            int mid = VM_Magic.getCompiledMethodID(fp);            VM_Method m1 = VM_CompiledMethods.getCompiledMethod(mid).getMethod();            fp = VM_Magic.getCallerFramePointer(fp);            mid = VM_Magic.getCompiledMethodID(fp);            VM_Method m2 = VM_CompiledMethods.getCompiledMethod(mid).getMethod();            String s = m1.getDeclaringClass() + "." + m1.getName() + " " + m2.getDeclaringClass() + "." + m2.getName();            VM_Scheduler.trace(VM_Magic.getObjectType(o).getName(), s, -2-retries);          }          if (0 != retries && VM_Processor.getCurrentProcessor().threadSwitchingEnabled()) {            VM_Thread.yield(); // wait, hope o gets unlocked          }        }        // create a heavy lock for o and lock it        if (inflateAndLock(o, lockOffset)) break major;       }       // o has been locked, must return before an exception can be thrown  }