summaryrefslogtreecommitdiffstats
path: root/libstdc++
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-11-15 15:47:02 +0100
committerDavid 'Digit' Turner <digit@google.com>2011-11-16 16:28:10 +0100
commite31bfae2baa96742f998155ee26e56c826a8ce3a (patch)
treeb12cfb44ad035c26278f42fa9b19095e90b79e95 /libstdc++
parent8180b08fb2f27052f9df2ae4787bb5bf409f13e0 (diff)
downloadbionic-e31bfae2baa96742f998155ee26e56c826a8ce3a.zip
bionic-e31bfae2baa96742f998155ee26e56c826a8ce3a.tar.gz
bionic-e31bfae2baa96742f998155ee26e56c826a8ce3a.tar.bz2
bionic: Do not use <sys/atomics.h> for platform code.
We're going to modify the __atomic_xxx implementation to provide full memory barriers, to avoid problems for NDK machine code that link to these functions. First step is to remove their usage from our platform code. We now use inlined versions of the same functions for a slight performance boost. + remove obsolete atomics_x86.c (was never compiled) NOTE: This improvement was benchmarked on various devices. Comparing a pthread mutex lock + atomic increment + unlock we get: - ARMv7 emulator, running on a 2.4 GHz Xeon: before: 396 ns after: 288 ns - x86 emulator in KVM mode on same machine: before: 27 ns after: 27 ns - Google Nexus S, in ARMv7 mode (single-core): before: 82 ns after: 76 ns - Motorola Xoom, in ARMv7 mode (multi-core): before: 121 ns after: 120 ns The code has also been rebuilt in ARMv5TE mode for correctness. Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
Diffstat (limited to 'libstdc++')
-rw-r--r--libstdc++/src/one_time_construction.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libstdc++/src/one_time_construction.cpp b/libstdc++/src/one_time_construction.cpp
index 2a44c79..f3d7138 100644
--- a/libstdc++/src/one_time_construction.cpp
+++ b/libstdc++/src/one_time_construction.cpp
@@ -20,11 +20,11 @@ extern "C" int __cxa_guard_acquire(int volatile * gv)
// 6 untouched, wait and return 0
// 1 untouched, return 0
retry:
- if (__atomic_cmpxchg(0, 0x2, gv) == 0) {
+ if (__bionic_cmpxchg(0, 0x2, gv) == 0) {
ANDROID_MEMBAR_FULL();
return 1;
}
- __atomic_cmpxchg(0x2, 0x6, gv); // Indicate there is a waiter
+ __bionic_cmpxchg(0x2, 0x6, gv); // Indicate there is a waiter
__futex_wait(gv, 0x6, NULL);
if(*gv != 1) // __cxa_guard_abort was called, let every thread try since there is no return code for this condition
@@ -39,7 +39,7 @@ extern "C" void __cxa_guard_release(int volatile * gv)
// 2 -> 1
// 6 -> 1, and wake
ANDROID_MEMBAR_FULL();
- if (__atomic_cmpxchg(0x2, 0x1, gv) == 0) {
+ if (__bionic_cmpxchg(0x2, 0x1, gv) == 0) {
return;
}