diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-30 21:19:49 -0200 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-11-30 21:19:49 -0200 |
commit | cfe8acb19870cb82b4508d208e5df8525536a46d (patch) | |
tree | 00fa1777fc730d888f0e9333e26e60583f3aadea /include/my_libwrap.h | |
parent | e1e81ceb83dfc344cb20675604d46e8cb0e7403d (diff) | |
download | mariadb-git-cfe8acb19870cb82b4508d208e5df8525536a46d.tar.gz |
Bug#56760: my_atomics failures on osx10.5-x86-64bit
The problem was due to a misuse of GCC asm constraints used to
implement a atomic load. On x86_64, the load was implemented
as a cmpxchg which implicitly uses the eax register as a
source and destination operand, yet the dummy value used for
comparison wasn't being properly loaded into eax (and other
problems).
The core problem is that cmpxchg is unnecessary as a load
on x86_64 as there are other simpler instructions such
as xadd. Even though, such instructions are only used to
have a memory barrier as load and stores are atomic by
definition. Hence, the solution is to explicitly issue the
required CPU and compiler barriers.
include/atomic/x86-gcc.h:
Issue a synchronizing instruction before loading the value.
Afterwards, issue a compiler barrier to prevent reordering.
Diffstat (limited to 'include/my_libwrap.h')
0 files changed, 0 insertions, 0 deletions