diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-04-29 13:55:29 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-04-29 13:55:29 +0100 |
commit | 7bbdd8d13e6cc06d77321209a945edf64350a5ac (patch) | |
tree | bf1c60d75958f3b115b36a4036e9039a745954b0 | |
parent | ad1f4687368ea026a0060969da1edd4dc1abbbfe (diff) | |
download | gcc-7bbdd8d13e6cc06d77321209a945edf64350a5ac.zip gcc-7bbdd8d13e6cc06d77321209a945edf64350a5ac.tar.gz gcc-7bbdd8d13e6cc06d77321209a945edf64350a5ac.tar.bz2 |
PR libstdc++/71312 Increase alignment of pooled mutexes
PR libstdc++/71312
* src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes.
From-SVN: r270649
-rw-r--r-- | libstdc++-v3/ChangeLog | 3 | ||||
-rw-r--r-- | libstdc++-v3/src/c++11/shared_ptr.cc | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a5482bb..2168a79 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2019-04-29 Jonathan Wakely <jwakely@redhat.com> + PR libstdc++/71312 + * src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes. + * include/bits/stl_bvector.h (vector<bool>::empty()): Add nodiscard attribute. diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc index 1f1323e..a4e833b 100644 --- a/libstdc++-v3/src/c++11/shared_ptr.cc +++ b/libstdc++-v3/src/c++11/shared_ptr.cc @@ -34,7 +34,9 @@ namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden) __gnu_cxx::__mutex& get_mutex(unsigned char i) { - static __gnu_cxx::__mutex m[mask + 1]; + // increase alignment to put each lock on a separate cache line + struct alignas(64) M : __gnu_cxx::__mutex { }; + static M m[mask + 1]; return m[i]; } } |