final Address objectPtr = ObjectReference.fromObject(object).toAddress();
final Address statusPtr = objectPtr.add(ObjectLayout.FLAGS_SLOT * Address.size());
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.