for (;;) {
// attempt fast path: object is not locked.
final Word oldlockword = statusPtr.prepareWord();
final Word statusFlags = oldlockword.and(Word.fromIntZeroExtend(ObjectFlags.STATUS_FLAGS_MASK));
if (statusPtr.attempt(statusFlags, statusFlags.or(tid))) {
// fast path succeeded, the object was not locked and
// has been locked by the current thread.
return;
}