Skip to content

Commit

Permalink
Improve ethread atomics
Browse files Browse the repository at this point in the history
The ethread atomics API now also provide double word size atomics.
Double word size atomics are implemented using native atomic
instructions on x86 (when the cmpxchg8b instruction is available)
and on x86_64 (when the cmpxchg16b instruction is available). On
other hardware where 32-bit atomics or word size atomics are
available, an optimized fallback is used; otherwise, a spinlock,
or a mutex based fallback is used.

The ethread library now performs runtime tests for presence of
hardware features, such as for example SSE2 instructions, instead
of requiring this to be determined at compile time.

There are now functions implementing each atomic operation with the
following implied memory barrier semantics: none, read, write,
acquire, release, and full. Some of the operation-barrier
combinations aren't especially useful. But instead of filtering
useful ones out, and potentially miss a useful one, we implement
them all.

A much smaller set of functionality for native atomics are required
to be implemented than before. More or less only cmpxchg and a
membar macro are required to be implemented for each atomic size.
Other functions will automatically be constructed from these. It is,
of course, often wise to implement more that this if possible from a
performance perspective.
  • Loading branch information
rickard-green committed Jun 14, 2011
1 parent 4a5a758 commit 7f19af0
Show file tree
Hide file tree
Showing 56 changed files with 19,442 additions and 3,039 deletions.
8 changes: 1 addition & 7 deletions INSTALL.md
Expand Up @@ -273,12 +273,6 @@ Some of the available `configure` options are:
* `--with-ssl=PATH` - Specify location of OpenSSL include and lib
* `--{with,without}-ssl` - OpenSSL (without implies that the `crypto`,
`ssh`, and `ssl` won't be built)
* `--enable-ethread-pre-pentium4-compatibility` - Enable compatibility with
x86 processors before pentium 4 (back to 486) in the ethread library. If
not passed the ethread library (part of the runtime system) will use
instructions that first appeared on the pentium 4 processor when building
for x86. This option will be automatically enabled if required on the
build machine.
* `--with-libatomic_ops=PATH` - Use the `libatomic_ops` library for atomic
memory accesses. If `configure` should inform you about no native atomic
implementation available, you typically want to try using the
Expand Down Expand Up @@ -726,7 +720,7 @@ Copyright and License

%CopyrightBegin%

Copyright Ericsson AB 1998-2010. All Rights Reserved.
Copyright Ericsson AB 1998-2011. All Rights Reserved.

The contents of this file are subject to the Erlang Public License,
Version 1.1, (the "License"); you may not use this file except in
Expand Down
6 changes: 1 addition & 5 deletions configure.in
Expand Up @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.

dnl %CopyrightBegin%
dnl
dnl Copyright Ericsson AB 1998-2010. All Rights Reserved.
dnl Copyright Ericsson AB 1998-2011. All Rights Reserved.
dnl
dnl The contents of this file are subject to the Erlang Public License,
dnl Version 1.1, (the "License"); you may not use this file except in
Expand Down Expand Up @@ -306,10 +306,6 @@ AS_HELP_STRING([--enable-m32-build],
esac
],enable_m32_build=no)

AC_ARG_ENABLE(ethread-pre-pentium4-compatibility,
AS_HELP_STRING([--enable-ethread-pre-pentium4-compatibility],
[enable compatibility with x86 processors before pentium 4 (back to 486) in the ethread library]))

AC_ARG_WITH(libatomic_ops,
AS_HELP_STRING([--with-libatomic_ops=PATH],
[specify and prefer usage of libatomic_ops in the ethread library]))
Expand Down

0 comments on commit 7f19af0

Please sign in to comment.