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
This commit is contained in:
Jonathan Wakely 2019-04-29 13:55:29 +01:00 committed by Jonathan Wakely
parent ad1f468736
commit 7bbdd8d13e
2 changed files with 6 additions and 1 deletions

View File

@ -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.

View File

@ -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];
}
}