[PATCH] D129162: [BOLT] Change mutex implementation
Elvina Yakubova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 22:24:19 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG35155a071678: [BOLT] Change mutex implementation (authored by Elvina).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129162/new/
https://reviews.llvm.org/D129162
Files:
bolt/runtime/common.h
Index: bolt/runtime/common.h
===================================================================
--- bolt/runtime/common.h
+++ bolt/runtime/common.h
@@ -468,17 +468,12 @@
reportError(Buf, Ptr - Buf);
}
-/// 1B mutex accessed by lock xchg
class Mutex {
volatile bool InUse{false};
public:
- bool acquire() {
- bool Result = true;
- asm volatile("lock; xchg %0, %1" : "+m"(InUse), "=r"(Result) : : "cc");
- return !Result;
- }
- void release() { InUse = false; }
+ bool acquire() { return !__atomic_test_and_set(&InUse, __ATOMIC_ACQUIRE); }
+ void release() { __atomic_clear(&InUse, __ATOMIC_RELEASE); }
};
/// RAII wrapper for Mutex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129162.442441.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220706/e670832b/attachment.bin>
More information about the llvm-commits
mailing list