Fix and code refactoring of lock elision workaround (Linux/x64)
authorIvan Maidanski <ivmai@mail.ru>
Sat, 19 Jul 2014 08:52:54 +0000 (12:52 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 10 Sep 2014 23:18:59 +0000 (03:18 +0400)
commit3d342554dc03af8d27925706a6513080995e1904
treecff6ebe570a1fabf04c55c3080c890cfd8f14e5e
parentf2b1938c2133a42afdd3405c3d17445e771e317d
Fix and code refactoring of lock elision workaround (Linux/x64)

* configure.ac (HAVE_LIBC_VERSION_H, HAVE_GNU_GET_LIBC_VERSION): Remove
(revert change in previous commit).
* include/private/gcconfig.h (GLIBC_2_19_TSX_BUG): New macro defined
for Linux/x86_64 (if Glibc used) to workaround a bug in Glibc lock
elision implementation.
* pthread_support.c: Move include of gnu/libc-version.h to gcconfig.h
(used to check whether lock elision workaround needed).
* misc.c (GC_init): Reformat code.
* pthread_support.c (mark_mutex): Initialize (to
PTHREAD_MUTEX_INITIALIZER) even lock elision workaround is needed
(revert change in previous commit).
* pthread_support.c (parse_version): New static function (defined only
if GLIBC_2_19_TSX_BUG).
* pthread_support.c (GC_setup_mark_lock): Use parse_version to check
target Glibc version properly; do not reinitialize mutex unless
workaround needed; call ABORT (with the appropriate message) in case
of a failure in pthread_mutexattr_init/settype, pthread_mutex_init.
configure.ac
include/private/gcconfig.h
misc.c
pthread_support.c