| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL moves the Chrome code base to C++11 atomics instead of inline
assembly for the toolchains that support C++11's <atomic>. The patch is
constructed to modify as little code as possible, and will be followed-up with
other patches to clean up the rest of the code base.
This change should allow compilers to emit better code when dealing with atomics
(LLVM has recently seen substantial improvements thanks to morisset's work), be
more portable, eventually delete a bunch of code, and in subsequent changes
atomicity will be based on memory location instead of individual accesses (making
the code less error-prone, and easier to analyze).
This patch stems from a fix I recently made to V8 to build under NaCl and
PNaCl. This was gating V8's C++11 migration: they needed to move to the
LLVM-based NaCl toolchain which didn't work with atomicops' inline assembly. V8
currently uses the __sync_* primitives for the NaCl/PNaCl build, which imply
sequential consistency and are therefore suboptimal. Before doing further work I
want to fix Chrome's own headers, and trickle these changes to V8.
Future changes:
* The atomicops headers are copied in 8 locations [0] in the Chrome code base,
not all of them are up to date. Those should all be updated in their
individual repositories (some are in thiry_party).
* The signature of functions should be updated to take an atomic location
instead of the pointer argument, and all call sites should be updated (there
are current 127 such calls [1] in chromium/src in non-implementation and
non-test files).
* Atomic operations should be used directly.
A few things worth noting:
* The atomicops_internals_portable.h file contains the main implementation, and
has extra notes on implementation choices.
* The CL removes x86 CPU features detection from the portable implementation:
- Because the headers are copied in a few places and the x86 CPU feature
detection uses a static global that parses cpuid, the
atomicops_internals_x86_gcc.cc file was only built once, but its struct
interface was declared external and used in protobuf and
tcmalloc. Removing the struct from Chrome's own base makes the linker sad
because of the two uses. This has two implications:
# Don't specialize atomics for SSE2 versus non SSE2. This is a non-issue
since Chrome requires a minimum of SSE2. The code is therefore faster
(skip a branch).
# The code doesn't detect the AMD Opteron Rev E memory barrier bug from
AMD errata 147 [2]. This bug affects Opterons 1xx/2xx/8xx that shipped
in 2003-2004. In general compilers should work around this bug, not
library code. GCC has had this workaround since 2009 [3], but it is
still an open bug in LLVM [4]. See comment #27 on the code review: this
CPU is used by 0.02% of Chrome users, for whom the race would have to
occur and the compiler not have the workaround for the bug to manifest.
This also makes the code faster by skipping a branch.
* The CL moves the declaration of the x86 CPU features struct to atomicops.h,
and matches its fields with the ones duplicated across the code base. This
is transitional: it fixes a link failure because tcmalloc relied on the
x86_gcc.{h,cc} declaration and implementation, and it fixes an ODR violation
where the struct didn't always have 3 members (and the other members were
sometimes accessed, uninitialized).
* tsan already rewrites all atomics to its own primitives, its header is
therefore now unnecessary. The implementation takes care to detect and error
out if that turns out not to be true.
* MemoryBarrier works around a libstdc++ bug in older versions [5]. The
workaround is exactly the non-buggy code for libstdc++ (call out to the
compiler's builtin).
* The assembly generated by GCC 4.8 and LLVM 3.6 for x86-32/x86-64/ARM when
using this portable implementation can be found in [6].
[0]: find . -name "atomicops.h"
./base/atomicops.h
./v8/src/base/atomicops.h
./native_client_sdk/src/libraries/sdk_util/atomicops.h
./third_party/webrtc/base/atomicops.h
./third_party/tcmalloc/chromium/src/base/atomicops.h
./third_party/tcmalloc/vendor/src/base/atomicops.h
./third_party/re2/util/atomicops.h
./third_party/protobuf/src/google/protobuf/stubs/atomicops.h
[1]: git grep Barrier_ | grep -v atomicops | grep -v unittest | wc -l
[2]: http://support.amd.com/us/Processor_TechDocs/25759.pdf
[3]: https://gcc.gnu.org/ml/gcc-patches/2009-10/txt00046.txt
[4]: http://llvm.org/bugs/show_bug.cgi?id=5934
[5]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51038
[6]: https://code.google.com/p/chromium/issues/detail?id=423074
TEST=ninja -C out/Release base_unittests
TEST=trybots
BUG=246514
BUG=234215
BUG=420970
BUG=423074
R= dvyukov@google.com, thakis@chromium.org, glider@chromium.org, hboehm@google.com, morisset@google.com, willchan@chromium.org
Review URL: https://codereview.chromium.org/636783002
Cr-Commit-Position: refs/heads/master@{#299485}
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds atomic operations for MIPS64.
BUG=400684
Review URL: https://codereview.chromium.org/450343002
Cr-Commit-Position: refs/heads/master@{#289624}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289624 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
BUG=NONE
TEST=NONE
Review URL: https://codereview.chromium.org/232973002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263554 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
| |
These are taken from the implementation in v8/src/atomicops_internals_a64_gcc.h
BUG=354405
Review URL: https://codereview.chromium.org/206373005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258985 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use <stdint.h> instead of "base/basictypes.h".
Put AtomicOps_Internalx86CPUFeaturesInit in the anonymous namespace.
Fix formatting issues.
BUG=
Review URL: https://codereview.chromium.org/143273005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249938 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Android/ARM).
The previous patch at:
https://chromiumcodereview.appspot.com/10831358
actually regressed the performance of atomic operations on Linux/ARM systems, because
the GCC intrinsics (e.g. __sync_fetch_and_add) are very poorly implemented at the
moment (and also always provide a full barrier, even when the caller doesn't need it).
This replaces the implementation with a better version which:
- Uses inline assembly and LDRES/STREX instructions on ARMv6+, or the old
kernel helper cmpxchg implementation on ARMv5.
- Still uses the kernel helper memory barrier to optimize for single core
devices on ARMv6 and ARMv7, or ARMv5 binaries running on devices with
a higher architecture number.
- Provide truly barrier free compare-and-swap, swap and atomic-inc
operations.
On tested Android/ARM devices, this speeds up atomic increments by x2 to x3.
This indirectly speeds up other operations relying on it (e.g. scoped_refptr<>
or base::Bind()). For details, see:
https://docs.google.com/a/chromium.org/spreadsheet/ccc?key=0Arp73PHrzcIQdGNUd1NGYWlfY0dKWS1EZ2V6RThhZXc&usp=sharing
BUG=234215
Review URL: https://chromiumcodereview.appspot.com/16335007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205205 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
| |
The x32 logic for the size of Atomic64 handles NaCL, but misses
the Linux case. Check the standard __ILP32__ to handle that too.
BUG=chromium-os:36866
TEST=compiled the code for x86_64 (64bit) & x86_64 (x32)
Review URL: https://chromiumcodereview.appspot.com/12186005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181114 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
windows.h #defines "MemoryBarrier" on x64 (on x86 it's an forceinline function). Because atomicops.h uses MemoryBarrier as the public api name, workaround by #undefing and then calling the implementation directly.
ref: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx
R=brettw@chromium.org
BUG=166496
Review URL: https://chromiumcodereview.appspot.com/11888016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176859 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
(http://dev.chromium.org/developers/testing/threadsanitizer-tsan-v2)
BUG=128314
Review URL: https://codereview.chromium.org/10948035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159705 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
| |
This makes the arm version of atomicops_internals use gcc intrinsics for the NaCl
build. Other linux targets won't change.
BUG=116317
TEST=compiles on arm bots
Review URL: https://chromiumcodereview.appspot.com/10831358
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152791 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
| |
The atomicops_internal file for Mac and iOS is not actually architecture-specific, so it is being renamd to be arch-independent.
BUG=b/6754112
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10696193
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146584 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
For context see this thread:
https://groups.google.com/a/chromium.org/forum/?fromgroups#!topic/chromium-dev/RMcVNGjB4II
TBR=thakis,pkasting,jam
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146163 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
| |
Initial commit for atomic operations on MIPS architecture.
BUG=https://code.google.com/p/chromium/issues/detail?id=130022
TEST=make chrome
Review URL: https://chromiumcodereview.appspot.com/10448043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142663 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
This flag was removed from our build in 2008, so we no longer
need workarounds to support it.
Review URL: http://codereview.chromium.org/7477030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94480 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This still needs a little hack. I had to run gyp_chromium this way:
CHROMIUM_GYP_FILE="base/base.gyp" build/gyp_chromium -DOS=openbsd \
-Duse_gnome_keyring=0 -Duse_system_libevent=1
And then run "gmake base".
BUG=none
Review URL: http://codereview.chromium.org/6840023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81709 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* at_exit.cc
* atomicops.h
* base_paths.h
* bzip2_error_handler.cc
* callback_internal.h
* command_line.cc
* cpu.cc
* environment.h
* event_recorder.cc
* file_descriptor_shuffle.cc
* file_path.cc
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6759017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80340 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
| |
Turns out intptr_t isn't 64 bits wide in 64-bit NaCl. This class assumes that
Atomic64 is actually 64 bits wide, so we need to use the int64_t type instead.
Original patch by Eric Seidel.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67826 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
BUG=50273
TEST=everything still builds, build is 10% faster on windows, same speed on mac/linux
TBR: erg
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53716 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
| |
- Use long for int64 (still 64 bits) to avoid annoying nspr clash.
- Fix some incorrect define guards and add some functions to atomicops.
Review URL: http://codereview.chromium.org/159428
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21709 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
| |
Review URL: http://codereview.chromium.org/57031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15070 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
Normalize end of file newlines in base/. All files end in a single newline.
Review URL: http://codereview.chromium.org/42011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11329 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
| |
atomicops_internals_x86_macosx.h. I didn't realize this was brought in as-is
from upstream.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1451 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
| |
base.xcodeproj.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1446 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
| |
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
| |
uses the Apple APIs for atomic operations and not inline assembly.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@432 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
| |
compiler/platform specific defines in the platform dependent internals headers, keeping them closer to the original implementation.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@372 0039d316-1c4b-4281-b951-d872f2087c98
|
|
operations in google-perftools / tcmalloc.
- Makes atomic operations cross-platform (win/mac/linux).
- Supports 64 bit operations on 64 bit processors.
- Make atomic operations more correct on Windows (barriers).
- Introduces a better / safer interface, and abstracts away most common atomic operations, reference counting and sequence numbers.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@370 0039d316-1c4b-4281-b951-d872f2087c98
|