]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove unused Atomic::Word and GNU atomics
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 2 Jun 2015 23:04:21 +0000 (16:04 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 2 Jun 2015 23:04:21 +0000 (16:04 -0700)
configure.ac
src/MemStore.cc
src/ipc/AtomicWord.cc [deleted file]
src/ipc/AtomicWord.h [deleted file]
src/ipc/Makefile.am

index 99571751733e146580a2f1b8b47b8cd1bb0b0c2c..290b6087a8514bb455ad525bc26aa5dc4cddec66 100644 (file)
@@ -419,40 +419,6 @@ SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
 # to be used by sub-commands
 export enable_inline
 
-# Check for atomic operations support in the compiler
-AC_CACHE_CHECK([for GNU atomic operations support],[squid_cv_gnu_atomics],[
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include <cstdint>
-    int32_t n_32 = 0;
-    uint64_t n_64 = 0;
-]],[[
-    // 32-bit
-    __sync_add_and_fetch(&n_32, 10); // n becomes 10
-    __sync_fetch_and_add(&n_32, 20); // n becomes 30
-    __sync_sub_and_fetch(&n_32, 15); // n becomes 15
-    __sync_bool_compare_and_swap(&n_32, 15, 201); // n becomes 201
-    __sync_fetch_and_and(&n_32, 200); // n becomes 200
-    if (n_32 != 200) return -1;
-
-    // 64-bit
-    __sync_add_and_fetch(&n_64, 10); // n becomes 10
-    __sync_fetch_and_add(&n_64, 20); // n becomes 30
-    __sync_sub_and_fetch(&n_64, 15); // n becomes 15
-    __sync_bool_compare_and_swap(&n_64, 15, 201); // n becomes 201
-    __sync_fetch_and_and(&n_64, 200); // n becomes 200
-    if (n_64 != 200) return -1;
-
-    // seems to be okay.
-    return 0;
-]])],
-[
-       squid_cv_gnu_atomics=yes
-],[
-       squid_cv_gnu_atomics=no
-])
-])
-SQUID_DEFINE_BOOL(HAVE_ATOMIC_OPS,${squid_cv_gnu_atomics:=yes},[Define to 1 if you have GCC __sync_add_and_fetch() and such])
-
 AC_ARG_ENABLE(debug-cbdata,
   AS_HELP_STRING([--enable-debug-cbdata],
       [Provide some debug information in cbdata]), [ 
index e9142c52f328315d7643815b035cd386764240b9..a4a4d4d602c184aa77a830961d11c560bef10fde 100644 (file)
@@ -12,7 +12,6 @@
 #include "base/RunnersRegistry.h"
 #include "CollapsedForwarding.h"
 #include "HttpReply.h"
-#include "ipc/AtomicWord.h"
 #include "ipc/mem/Page.h"
 #include "ipc/mem/Pages.h"
 #include "MemObject.h"
@@ -802,12 +801,8 @@ MemStoreRr::finalizeConfig()
 {
     // decide whether to use a shared memory cache if the user did not specify
     if (!Config.memShared.configured()) {
-        Config.memShared.configure(Ipc::Atomic::Enabled() &&
-                                   Ipc::Mem::Segment::Enabled() && UsingSmp() &&
+        Config.memShared.configure(Ipc::Mem::Segment::Enabled() && UsingSmp() &&
                                    Config.memMaxSize > 0);
-    } else if (Config.memShared && !Ipc::Atomic::Enabled()) {
-        // bail if the user wants shared memory cache but we cannot support it
-        fatal("memory_cache_shared is on, but no support for atomic operations detected");
     } else if (Config.memShared && !Ipc::Mem::Segment::Enabled()) {
         fatal("memory_cache_shared is on, but no support for shared memory detected");
     } else if (Config.memShared && !UsingSmp()) {
diff --git a/src/ipc/AtomicWord.cc b/src/ipc/AtomicWord.cc
deleted file mode 100644 (file)
index e6c6fd1..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 54    Interprocess Communication */
-
-#include "squid.h"
-#include "ipc/AtomicWord.h"
-#include "tools.h"
-
-bool Ipc::Atomic::Enabled()
-{
-#if HAVE_ATOMIC_OPS
-    return true;
-#else
-    return !UsingSmp();
-#endif
-}
-
diff --git a/src/ipc/AtomicWord.h b/src/ipc/AtomicWord.h
deleted file mode 100644 (file)
index 2335588..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef SQUID_IPC_ATOMIC_WORD_H
-#define SQUID_IPC_ATOMIC_WORD_H
-
-namespace Ipc
-{
-
-namespace Atomic
-{
-
-/// Whether atomic operations support is available
-bool Enabled();
-
-#if HAVE_ATOMIC_OPS
-
-/// Supplies atomic operations for an integral Value in memory shared by kids.
-/// Used to implement non-blocking shared locks, queues, tables, and pools.
-template <class ValueType>
-class WordT
-{
-public:
-    typedef ValueType Value;
-
-    WordT() {} // leave value unchanged
-    WordT(Value aValue): value(aValue) {} // XXX: unsafe
-
-    Value operator +=(int delta) { return __sync_add_and_fetch(&value, delta); }
-    Value operator -=(int delta) { return __sync_sub_and_fetch(&value, delta); }
-    Value operator ++() { return *this += 1; }
-    Value operator --() { return *this -= 1; }
-    Value operator ++(int) { return __sync_fetch_and_add(&value, 1); }
-    Value operator --(int) { return __sync_fetch_and_sub(&value, 1); }
-
-    bool swap_if(const Value comparand, const Value replacement) { return __sync_bool_compare_and_swap(&value, comparand, replacement); }
-
-    /// v1 = value; value &= v2; return v1;
-    Value fetchAndAnd(const Value v2) { return __sync_fetch_and_and(&value, v2); }
-
-    // TODO: no need for __sync_bool_compare_and_swap here?
-    bool operator ==(const Value v2) { return __sync_bool_compare_and_swap(&value, v2, value); }
-
-    // TODO: no need for __sync_fetch_and_add here?
-    Value get() const { return __sync_fetch_and_add(const_cast<Value*>(&value), 0); }
-    operator Value () const { return get(); }
-
-private:
-
-    Value value;
-};
-
-#else
-
-/// A wrapper to provide AtomicWordT API (and implementation asserting in SMP mode)
-/// where we do not support atomic operations. This avoids ifdefs in core code.
-template <class ValueType>
-class WordT
-{
-public:
-    typedef ValueType Value;
-
-    WordT() {} // leave value unchanged
-    WordT(Value aValue): value(aValue) {} // XXX: unsafe
-
-    Value operator +=(int delta) { assert(Enabled()); return value += delta; }
-    Value operator ++() { return *this += 1; }
-    Value operator --() { return *this += -1; }
-    Value operator ++(int) { assert(Enabled()); return value++; }
-    Value operator --(int) { assert(Enabled()); return value--; }
-
-    bool swap_if(const Value comparand, const Value replacement)
-    { assert(Enabled()); return value == comparand ? value = replacement, true : false; }
-
-    /// v1 = value; value &= v2; return v1;
-    Value fetchAndAnd(const Value v2)
-    { assert(Enabled()); const Value v1 = value; value &= v2; return v1; }
-
-    // TODO: no need for __sync_bool_compare_and_swap here?
-    bool operator ==(const Value v2) { assert(Enabled()); return value == v2; }
-
-    // TODO: no need for __sync_fetch_and_add here?
-    Value get() const { assert(Enabled()); return value; }
-    operator Value () const { return get(); }
-
-private:
-
-    Value value;
-};
-
-#endif /* HAVE_ATOMIC_OPS */
-
-typedef WordT<int> Word;
-
-} // namespace Atomic
-
-} // namespace Ipc
-
-#endif // SQUID_IPC_ATOMIC_WORD_H
-
index ec648e4d6013c564fcdc50b3b83ae44cf1ed4075..0d5f9c67fadc414322819b72f379a9d753f26f56 100644 (file)
@@ -13,8 +13,6 @@ AUTOMAKE_OPTIONS = subdir-objects
 noinst_LTLIBRARIES = libipc.la
 
 libipc_la_SOURCES = \
-       AtomicWord.cc \
-       AtomicWord.h \
        FdNotes.cc \
        FdNotes.h \
        Kid.cc \