Changeset 207073 in webkit
- Timestamp:
- Oct 11, 2016 2:53:39 AM (8 years ago)
- Location:
- releases/WebKitGTK/webkit-2.14/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.14/Source/WTF/ChangeLog
r207071 r207073 1 2016-09-14 JF Bastien <jfbastien@apple.com> 2 3 Alwasys inline atomic operations 4 https://bugs.webkit.org/show_bug.cgi?id=155371 5 6 Reviewed by Geoffrey Garen. 7 8 Fixes "build fails with memory model cannot be stronger than 9 success memory model for ‘__atomic_compare_exchange’". 10 11 Pre-5 revisions of GCC at Os only generated an error message 12 related to invalid failure memory ordering. The reason is that 13 libstdc++ tries to be clever about enforcing the C++ standard's 14 clause [atomics.types.operations.req] ¶21 which states: 15 16 Requires: The failure argument shall not be 17 `memory_order_release` nor `memory_order_acq_rel`. The failure 18 argument shall be no stronger than the success argument. 19 20 It fails at doing this because its inlining heuristics are 21 modified by Os, and they're not quite as dumb as O0 but not smart 22 enough to get to the good code at O1. Adding ALWAYS_INLINE fixes 23 the silliness at Os, leaves O1 great, and makes O0 slightly less 24 bad but still pretty bad. 25 26 The other good news is that I'm going to get this particular 27 problem fixed in the version of C++ which will come after C++17: 28 29 https://github.com/jfbastien/papers/blob/master/source/P0418r1.bs 30 31 While we're at it we should always inline all of these wrapped 32 functions because the generated code is horrendous if the memory 33 order isn't known at compile time. 34 35 * wtf/Atomics.h: 36 (WTF::Atomic::load): 37 (WTF::Atomic::store): 38 (WTF::Atomic::compareExchangeWeak): 39 (WTF::Atomic::compareExchangeStrong): 40 (WTF::Atomic::exchangeAndAdd): 41 (WTF::Atomic::exchange): 42 1 43 2016-09-12 Filip Pizlo <fpizlo@apple.com> 2 44 -
releases/WebKitGTK/webkit-2.14/Source/WTF/wtf/Atomics.h
r199760 r207073 53 53 // is usually not high enough to justify the risk. 54 54 55 T load(std::memory_order order = std::memory_order_seq_cst) const { return value.load(order); }55 ALWAYS_INLINE T load(std::memory_order order = std::memory_order_seq_cst) const { return value.load(order); } 56 56 57 void store(T desired, std::memory_order order = std::memory_order_seq_cst) { value.store(desired, order); }57 ALWAYS_INLINE void store(T desired, std::memory_order order = std::memory_order_seq_cst) { value.store(desired, order); } 58 58 59 bool compareExchangeWeak(T expected, T desired, std::memory_order order = std::memory_order_seq_cst)59 ALWAYS_INLINE bool compareExchangeWeak(T expected, T desired, std::memory_order order = std::memory_order_seq_cst) 60 60 { 61 61 #if OS(WINDOWS) … … 68 68 } 69 69 70 bool compareExchangeStrong(T expected, T desired, std::memory_order order = std::memory_order_seq_cst)70 ALWAYS_INLINE bool compareExchangeStrong(T expected, T desired, std::memory_order order = std::memory_order_seq_cst) 71 71 { 72 72 #if OS(WINDOWS) … … 79 79 80 80 template<typename U> 81 T exchangeAndAdd(U addend, std::memory_order order = std::memory_order_seq_cst)81 ALWAYS_INLINE T exchangeAndAdd(U addend, std::memory_order order = std::memory_order_seq_cst) 82 82 { 83 83 #if OS(WINDOWS) … … 88 88 } 89 89 90 T exchange(T newValue, std::memory_order order = std::memory_order_seq_cst)90 ALWAYS_INLINE T exchange(T newValue, std::memory_order order = std::memory_order_seq_cst) 91 91 { 92 92 #if OS(WINDOWS)
Note: See TracChangeset
for help on using the changeset viewer.