[PATCH] D88747: scudo: Simplify AtomicOptions::setFillContentsMode. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 10:30:48 PDT 2020
pcc created this revision.
pcc added reviewers: eugenis, cryptoad.
Herald added subscribers: Sanitizers, jfb.
Herald added a project: Sanitizers.
pcc requested review of this revision.
Repository:
rG LLVM Github Monorepo
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.295864.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201002/a4b67d37/attachment.bin>
More information about the llvm-commits
mailing list