aboutsummaryrefslogtreecommitdiffstats
path: root/erts/include/internal/gcc
AgeCommit message (Collapse)Author
2017-05-04Update copyright yearRaimo Niskanen
2017-02-14Fixed typos in ertsAndrew Dryga
2015-06-18Change license text to APLv2Bruce Yinhe
2015-01-14Improve ethread atomics based on GCC builtinsRickard Green
* Use of __atomic builtins when available. * Improved configure test that checks for missing memory barrier in __sync_synchronize(). The old approach was to verify known working gcc versions and check gcc version at compile time. Besides not being very safe, the old approach often unnecessarily caused usage of the very expensive workaround. * Introduced (no overhead) workaround for missing clobber in __sync_synchronize() when using buggy LLVM implementation of __sync_synchronize(). * Implement native memory barriers for ARM processors supporting the DMB instruction. * Use of volatile store on Alpha as atomic set operation if no __atomic_store_n() is available (already used on x86/x86_64 Sparc V9, PowerPC, and MIPS). Fallback used when not using volatile store is typically very expensive. * Use volatile load on Alpha and ARM as atomic read operation if no __atomic_load_n() is available (already used on x86/x86_64 Sparc V9, PowerPC, and MIPS). Fallback when not using volatile load is typically very expensive.
2013-07-18Fix compile error on ARM and GCC < 4.1.0Johannes Weißl
Since b29ecbd (OTP-10418, R15B03) Erlang does not compile anymore with old versions of GCC that do not have atomic ops builtins on platforms where there is no native ethread implementation (e.g. ARM): In file included from ../include/internal/gcc/ethread.h:29, from ../include/internal/ethread.h:354, from beam/erl_threads.h:264, from beam/erl_smp.h:27, from beam/sys.h:413, from hipe/hipe_mkliterals.c:29: ../include/internal/gcc/ethr_membar.h:49:4: error: #error "No __sync_val_compare_and_swap" This patch adds a header guard in "gcc/ethread.h", as is present in "libatomic_ops/ethread.h".
2011-06-14Improve ethread atomicsRickard Green
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.
2010-12-15Add support for 32-bit atomicsRickard Green
2010-12-14Move atomic API into own filesRickard Green
2010-12-11Introduce ethr_sint_t and use it for atomicsRickard Green
The atomic memory operations interface used the 'long' type and assumed that it was of the same size as 'void *'. This is true on most platforms, however, not on Windows 64.
2010-09-07add MIPS architecture to GCC ethread atomics supportSteve Vinoski
Gcc for MIPS supports immediate atomic gets and sets, and also supports a working __sync_synchronize() for gcc 4.2 and greater.
2010-08-10Rewrite ethread libraryRickard Green
Large parts of the ethread library have been rewritten. The ethread library is an Erlang runtime system internal, portable thread library used by the runtime system itself. Most notable improvement is a reader optimized rwlock implementation which dramatically improve the performance of read-lock/read-unlock operations on multi processor systems by avoiding ping-ponging of the rwlock cache lines. The reader optimized rwlock implementation is used by miscellaneous rwlocks in the runtime system that are known to be read-locked frequently, and can be enabled on ETS tables by passing the `{read_concurrency, true}' option upon table creation. See the documentation of `ets:new/2' for more information. The ethread library can now also use the libatomic_ops library for atomic memory accesses. This makes it possible for the Erlang runtime system to utilize optimized atomic operations on more platforms than before. Use the `--with-libatomic_ops=PATH' configure command line argument when specifying where the libatomic_ops installation is located. The libatomic_ops library can be downloaded from: http://www.hpl.hp.com/research/linux/atomic_ops/ The changed API of the ethread library has also caused modifications in the Erlang runtime system. Preparations for the to come "delayed deallocation" feature has also been done since it depends on the ethread library. Note: When building for x86, the ethread library will now use instructions that first appeared on the pentium 4 processor. If you want the runtime system to be compatible with older processors (back to 486) you need to pass the `--enable-ethread-pre-pentium4-compatibility' configure command line argument when configuring the system.
2010-06-01OTP-8659 Add ethread support for gcc atomicsRickard Green
Support for using gcc's built-in functions for atomic memory access has been added. This functionallity will be used if available and no other native atomic implementation in ERTS is available.