[PATCH] D88747: scudo: Simplify AtomicOptions::setFillContentsMode. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 10:52:58 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa8938f3da319: scudo: Simplify AtomicOptions::setFillContentsMode. NFCI. (authored by pcc).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88747/new/
https://reviews.llvm.org/D88747
Files:
compiler-rt/lib/scudo/standalone/options.h
Index: compiler-rt/lib/scudo/standalone/options.h
===================================================================
--- compiler-rt/lib/scudo/standalone/options.h
+++ compiler-rt/lib/scudo/standalone/options.h
@@ -54,16 +54,14 @@
}
void setFillContentsMode(FillContentsMode FillContents) {
- while (1) {
- u32 Opts = atomic_load(&Val, memory_order_relaxed);
- u32 NewOpts = Opts;
+ u32 Opts = atomic_load(&Val, memory_order_relaxed), NewOpts;
+ do {
+ NewOpts = Opts;
NewOpts &= ~(3U << static_cast<u32>(OptionBit::FillContents0of2));
NewOpts |= static_cast<u32>(FillContents)
<< static_cast<u32>(OptionBit::FillContents0of2);
- if (atomic_compare_exchange_strong(&Val, &Opts, NewOpts,
- memory_order_relaxed))
- break;
- }
+ } while (!atomic_compare_exchange_strong(&Val, &Opts, NewOpts,
+ memory_order_relaxed));
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88747.295871.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201002/8bbfc25c/attachment.bin>
More information about the llvm-commits
mailing list