Commit Graph

31 Commits

Author SHA1 Message Date
Hannes Verschore
a0dc18dbde Bug 1061764 - Atomic<bool, Relaxed> should mean no synchronization on windows x86, r=froydnj 2014-09-04 11:08:00 +02:00
Nicholas Nethercote
8ea1b7923f Bug 1036789 - Convert the third quarter of MFBT to Gecko style. r=Ms2ger.
--HG--
extra : rebase_source : 668cd394806203ddfa34bd4f226335ff26c846b5
2014-07-10 19:10:17 -07:00
Ehsan Akhgari
161339a291 Bug 1025900 - #include intrin.h directly in Atomics.h instead of declaring functions manually from it; r=froydnj
This is basically more of bug 1022049.

--HG--
extra : rebase_source : 39cf2745d47d90ba1684c2c26a38f9781a4d179e
2014-06-16 18:19:49 -04:00
Ehsan Akhgari
d20024b5d5 Bug 1021290 - More Atomics.h build fixes for clang-cl. r=froydnj
This is basically more of bug 932454
2014-06-09 14:49:34 -04:00
Ehsan Akhgari
861dfcddf0 Bug 1013662 - Fix bad implicit conversion constructors in MFBT; r=froydnj,Waldo 2014-06-06 23:17:06 -04:00
Nathan Froyd
36d2e2a2ef Bug 1020118 - fix atomic add/sub for pointer types on Win64; r=jcranmer 2014-06-04 15:19:51 -04:00
Wes Kocher
bf241ec7e1 Backed out changeset 34f371b1024b (bug 1021290) for Windows build bustage on a CLOSED TREE 2014-06-05 17:35:47 -07:00
Jeff Muizelaar
6e8437869f Bug 1021290. More Atomics.h build fixes for clang-cl. r=froydnj
This is basically more of bug 932454

--HG--
extra : rebase_source : 0f9a5d43164efb6940d17e406f41691cb3d26435
2014-06-05 19:48:52 -04:00
Nicholas Nethercote
0b4c7c33bf Bug 1014377 - Convert the first quarter of MFBT to Gecko style. r=froydnj.
--HG--
extra : rebase_source : b3b2da775e2c0e8a6ecbed70e7bd0c8f7af67b47
2014-05-29 22:40:33 -07:00
David Major
679ccacb64 Bug 982310 - Hack around problems linking std::_Debug_message; r=ehsan
--HG--
extra : amend_source : 2e0f6f26823ee5fcce16dfaf8791ae57d8ac62cb
2014-03-21 12:53:00 -07:00
Viktor Stanchev
3d5e397bfe Bug 965837 - Add bool support to mozilla::Atomic. r=froydnj 2014-02-06 14:57:30 -05:00
Jeff Muizelaar
df3077c1c3 Bug 932454. Make Atomics.h compilable with clang on Windows. r=nfroyd,jwalden
MSVC is sloppy with typedefs leaking. Clang is more strict.

--HG--
extra : rebase_source : e8000f43391f8a32fbde96d54ff11e09e49345f9
2013-10-29 17:55:38 -04:00
Joshua Cranmer
642e66f518 Bug 906783 - Attempt to detect the standard C++ library version, r=Waldo 2013-08-29 22:44:23 -05:00
Trevor Saunders
f420929d6e bug 905243 - make the constructors for mozilla::Atomic constexpr r=froydnj 2013-08-14 16:28:17 -04:00
Nathan Froyd
73a2108665 Bug 900965 - compile failures with gcc 4.6.3 on std::atomic enum support from bug 888548 r=waldo 2013-08-02 18:18:41 -07:00
Birunthan Mohanathas
63e7a796e9 Bug 888548 - Part 3: Add enum support to mozilla::Atomic<T>. r=froydnj
Due to a bug in GCC, the compareExchange function is not available with enum types.
2013-08-01 21:21:32 -04:00
Birunthan Mohanathas
c171bc3e7e Bug 888548 - Part 2: Refactor and cleanup mozilla::Atomic<T> implementation. r=froydnj
This moves the increment and decrement operators from detail::AtomicBase to
detail::AtomicBaseIncDec and moves the implementation of the assignment
operator into detail::AtomicBase. Additionally, this changes the integral
implementation to use mozilla::EnableIf for its specialization.
2013-08-01 21:21:32 -04:00
Daniel Holbert
b9c2886259 backout f607ac59de19 (Bug 888548 part 2) for B2G build bustage 2013-07-31 19:05:05 -07:00
Daniel Holbert
ec8488ab01 backout fc98067f0aa4 (Bug 888548 part 3) for B2G build bustage 2013-07-31 19:04:25 -07:00
Birunthan Mohanathas
46877a9f5e Bug 888548 - Part 3: Add enum support to mozilla::Atomic<T>. r=froydnj
Due to a bug in GCC, the compareExchange function is not available with enum types.
2013-07-31 21:15:25 -04:00
Birunthan Mohanathas
23665e54d3 Bug 888548 - Part 2: Refactor and cleanup mozilla::Atomic<T> implementation. r=froydnj
This moves the increment and decrement operators from detail::AtomicBase to
detail::AtomicBaseIncDec and moves the implementation of the assignment
operator into detail::AtomicBase. Additionally, this changes the integral
implementation to use mozilla::EnableIf for its specialization.
2013-07-31 21:15:25 -04:00
Ehsan Akhgari
5ee21d6d3f Bug 895322 - Part 1: Replace the usages of MOZ_STATIC_ASSERT with C++11 static_assert; r=Waldo
This patch was mostly generated by running the following scripts on the codebase, with some
manual changes made afterwards:

# static_assert.sh
#!/bin/bash
# Command to convert an NSPR integer type to the equivalent standard integer type

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.cc" \
         -o -iname "*.mm" \) | \
    xargs -n 1 `dirname $0`/assert_replacer.py #sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_STATIC_ASSERT static_assert
hg rev --no-backup mfbt/Assertions.h \
                   media/webrtc/signaling/src/sipcc/core/includes/ccapi.h \
                   modules/libmar/src/mar_private.h \
                   modules/libmar/src/mar.h


# assert_replacer.py
#!/usr/bin/python

import sys
import re

pattern = re.compile(r"\bMOZ_STATIC_ASSERT\b")

def replaceInPlace(fname):
  print fname
  f = open(fname, "rw+")
  lines = f.readlines()
  for i in range(0, len(lines)):
    while True:
      index = re.search(pattern, lines[i])
      if index != None:
        index = index.start()
        lines[i] = lines[i][0:index] + "static_assert" + lines[i][index+len("MOZ_STATIC_ASSERT"):]
        for j in range(i + 1, len(lines)):
          if lines[j].find("                 ", index) == index:
            lines[j] = lines[j][0:index] + lines[j][index+4:]
          else:
            break
      else:
        break
  f.seek(0, 0)
  f.truncate()
  f.write("".join(lines))
  f.close()

argc = len(sys.argv)
for i in range(1, argc):
  replaceInPlace(sys.argv[i])

--HG--
extra : rebase_source : 4b4a4047d82f2c205b9fad8d56dfc3f1afc0b045
2013-07-18 13:59:53 -04:00
Nathan Froyd
8d86b320b1 Bug 898491 - use the four argument form of compare_exchange_strong in Atomics.h; r=Waldo
The C++ standard (29.6p20-22 in N3337) specifies limitations on the failure ordering
for atomic compare-and-exchange.  Specifically, you can't pass memory_order_acq_rel or
memory_order_release.  For the (T&, T, std::memory_order) version, which we use, the
standard specifies that the provided argument should be "lowered" to comply with the
above restrictions on the failure ordering (29.6p21).

However, it seems that some versions of GCC's <atomic> header don't follow the spec
for the generic versions of std::atomic<>, though they do follow the spec with the
appropriate specializations (bool, integer, and pointer) of std::atomic<>.  This
results in mysterious failures when using atomic enums, as bug 888548 purports to
do, and ReleaseAcquire ordering.

Happily, we can work around this by using the more explicit version of
compare-and-exchange.  I've chosen to add another member to AtomicOrderConstraints,
even though it'd be the same as LoadOrder.  I feel explicitness is to be preferred
here.
2013-07-26 12:31:19 -04:00
Ms2ger
28a9e7aa20 Bug 896341 - Update include guards and modelines in MFBT; r=Waldo 2013-07-24 09:41:39 +02:00
Timothy B. Terriberry
36244b03a6 Bug 881163 - Require gcc 4.5.2 for C++11 atomics, r=froydnj 2013-06-10 09:17:00 -07:00
Landry Breuil
55a063c0aa Bug 876156: Don't try using <atomic> on OpenBSD which uses an old libstdc++ r=nfroyd 2013-06-01 00:23:01 +02:00
Nathan Froyd
c36091d5a4 Bug 873649 - don't assume <atomic> is usable with clang on a Linux system; r=Waldo 2013-05-17 17:04:30 -04:00
Justin Lebar
7d53f5862c Bug 876691 - Unbreak mfbt/Atomics.h for Windows x64. r=me 2013-05-28 15:26:25 -04:00
Justin Lebar
c52e5d4a3e Bug 873800 - Add compare-and-exchange to mfbt/Atomics.h. r=froydnj
--HG--
extra : rebase_source : c9e455ed249e6b3cd0f532d240abfb602e2e88a8
2013-05-24 13:10:47 -04:00
Justin Lebar
499d8e2007 Bug 873799 - Add an explicit barrier before __sync_lock_test_and_set in mfbt/Atomics.h r=froydnj
--HG--
extra : rebase_source : 64d23f1df2fef8719413800ebb0afe6f51d1e3af
2013-05-24 13:10:47 -04:00
Nathan Froyd
a8d9cc8795 Bug 732043 - part 1 - add mfbt/Atomics.h; r=Waldo; original-author=jcranmer 2013-04-22 14:12:03 -04:00