Replaced deprecated atomic64_xxx types with int64_t, uint64_t
authorkhizmax <libcds.dev@gmail.com>
Sat, 1 Aug 2015 15:07:56 +0000 (18:07 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sat, 1 Aug 2015 15:07:56 +0000 (18:07 +0300)
15 files changed:
cds/algo/bitop.h
cds/compiler/gcc/amd64/bitop.h
cds/compiler/gcc/ia64/bitop.h
cds/compiler/gcc/sparc/bitop.h
cds/compiler/vc/amd64/bitop.h
cds/compiler/vc/x86/bitop.h
cds/details/bitop_generic.h
cds/details/defs.h
cds/intrusive/michael_list_rcu.h
cds/memory/michael/allocator.h
cds/memory/michael/bound_check.h
cds/memory/michael/osalloc_stat.h
cds/memory/michael/procheap_stat.h
cds/opt/options.h
tests/test-hdr/misc/bitop_st.cpp

index 4f9803b4c1f221bff9424c7a5bac95abc31976b7..a8ebb340ea418766a9c5145f5843a385ed3f8510 100644 (file)
@@ -44,7 +44,7 @@ namespace cds {
 
             // 64-bit bit ops
             template <> struct BitOps<8> {
-                typedef atomic64u_unaligned        TUInt;
+                typedef uint64_t TUInt;
 
                 static int      MSB( TUInt x )        { return bitop::platform::msb64( x );     }
                 static int      LSB( TUInt x )        { return bitop::platform::lsb64( x );     }
index 6c2f30370fa980cd5b3052f81ec43842ae75ddf3..912bf80ec54b41ea77100a953a23b43089ff71cd 100644 (file)
@@ -77,9 +77,9 @@ namespace cds {
         }
 
 #        define cds_bitop_msb64_DEFINED
-        static inline int msb64( atomic64u_unaligned nArg )
+        static inline int msb64( uint64_t nArg )
         {
-            atomic64u_unaligned        nRet;
+            uint64_t  nRet;
             asm volatile (
                 "bsrq        %[nArg], %[nRet]     ;\n\t"
                 "jnz        1f                    ;\n\t"
@@ -95,10 +95,10 @@ namespace cds {
         }
 
 #        define cds_bitop_msb64nz_DEFINED
-        static inline int msb64nz( atomic64u_unaligned nArg )
+        static inline int msb64nz( uint64_t nArg )
         {
             assert( nArg != 0 );
-            atomic64u_unaligned        nRet;
+            uint64_t nRet;
             __asm__ __volatile__ (
                 "bsrq        %[nArg], %[nRet]    ;"
                 : [nRet] "=a" (nRet)
@@ -110,10 +110,9 @@ namespace cds {
 
         // LSB - return index (0..31) of least significant bit in nArg. If nArg == 0 return -1U
 #        define cds_bitop_lsb64_DEFINED
-        static inline int lsb64( atomic64u_unaligned nArg )
+        static inline int lsb64( uint64_t nArg )
         {
-
-            atomic64u_unaligned        nRet;
+            uint64_t nRet;
             __asm__ __volatile__ (
                 "bsfq        %[nArg], %[nRet]     ;"
                 "jnz        1f        ;"
@@ -132,10 +131,10 @@ namespace cds {
         // LSB - return index (0..31) of least significant bit in nArg.
         // Condition: nArg != 0
 #        define cds_bitop_lsb64nz_DEFINED
-        static inline int lsb64nz( atomic64u_unaligned nArg )
+        static inline int lsb64nz( uint64_t nArg )
         {
             assert( nArg != 0 );
-            atomic64u_unaligned        nRet;
+            uint64_t nRet;
             __asm__ __volatile__ (
                 "bsfq        %[nArg], %[nRet]    ;"
                 : [nRet] "=a" (nRet)
index ef6846089dad8e320165d3d6f1b963647ae3d712..2eec2031c24a29b6b80c0be96be36e43c59dc192 100644 (file)
@@ -13,14 +13,14 @@ namespace cds {
         {
             if ( !nArg )
                 return 0;
-            atomic64u_t x = nArg;
+            uint64_t x = nArg;
             x |= x >> 1;
             x |= x >> 2;
             x |= x >> 4;
             x |= x >> 8;
             x |= x >> 16;
 
-            atomic64u_t    nRes;
+            uint64_t    nRes;
             asm __volatile__( "popcnt %0=%1\n\t" : "=r" (nRes) : "r" (x) );
             return (int) nRes;
         }
@@ -42,7 +42,7 @@ namespace cds {
         // MSB - return index (0..63) of most significant bit in nArg.
         // !!! nArg != 0
 #        define cds_bitop_msb64nz_DEFINED
-        static inline int msb64nz( atomic64u_t nArg )
+        static inline int msb64nz( uint64_t nArg )
         {
             assert( nArg != 0 );
             long double d = nArg;
index 99ee9fba5d230dd8d916b0f0ba95fec17fcb7ef8..12ea15f4caec4ba153f901b9aed5d1486e899f97 100644 (file)
@@ -11,9 +11,9 @@ namespace cds {
         // Source: UltraSPARC Architecture 2007
         //
         // Test result: this variant and its variation about 100 times slower then generic implementation :-(
-        static inline int sparc_msb64( atomic64u_t nArg )
+        static inline int sparc_msb64( uint64_t nArg )
         {
-            atomic64u_t result;
+            uint64_t result;
             asm volatile (
                 "neg %[nArg], %[result] \n\t"
                 "xnor %[nArg], %[result], %%g5 \n\t"
@@ -29,7 +29,7 @@ namespace cds {
         // MSB - return index (1..32) of most significant bit in nArg. If nArg == 0 return 0
         static inline int sparc_msb32( uint32_t nArg )
         {
-            return sparc_msb64( (atomic64u_t) nArg );
+            return sparc_msb64( (uint64_t) nArg );
         }
 
     }} // namespace gcc::Sparc
index c870bf1a7d6f3267dafc9d32d97e0b3e01cd2292..5c678cf4fe84057e54c8d984166b43c18c2e9eca 100644 (file)
@@ -68,7 +68,7 @@ namespace cds {
 
 
 #        define cds_bitop_msb64_DEFINED
-        static inline int msb64( atomic64u_unaligned nArg )
+        static inline int msb64( uint64_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanReverse64( &nIndex, nArg ))
@@ -77,7 +77,7 @@ namespace cds {
         }
 
 #        define cds_bitop_msb64nz_DEFINED
-        static inline int msb64nz( atomic64u_unaligned nArg )
+        static inline int msb64nz( uint64_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -86,7 +86,7 @@ namespace cds {
         }
 
 #        define cds_bitop_lsb64_DEFINED
-        static inline int lsb64( atomic64u_unaligned nArg )
+        static inline int lsb64( uint64_t nArg )
         {
             unsigned long nIndex;
             if ( _BitScanForward64( &nIndex, nArg ))
@@ -95,7 +95,7 @@ namespace cds {
         }
 
 #        define cds_bitop_lsb64nz_DEFINED
-        static inline int lsb64nz( atomic64u_unaligned nArg )
+        static inline int lsb64nz( uint64_t nArg )
         {
             assert( nArg != 0 );
             unsigned long nIndex;
@@ -110,7 +110,7 @@ namespace cds {
         }
 
 #       define cds_bitop_complement64_DEFINED
-        static inline bool complement64( atomic64u_t * pArg, unsigned int nBit )
+        static inline bool complement64( uint64_t * pArg, unsigned int nBit )
         {
             return _bittestandcomplement64( reinterpret_cast<__int64 *>( pArg ), nBit ) != 0;
         }
index 16ddf764a5cb3f53dc417f8c7acf07ab0f444ac7..89fdd4f6b94f1195bd7f75255321d79876e6f745 100644 (file)
@@ -65,7 +65,7 @@ namespace cds {
         }
 
 #       define cds_bitop_complement64_DEFINED
-        static inline bool complement64( atomic64u_t * pArg, unsigned int nBit )
+        static inline bool complement64( uint64_t * pArg, unsigned int nBit )
         {
             if ( nBit < 32 )
                 return _bittestandcomplement( reinterpret_cast<long *>( pArg ), nBit ) != 0;
index 6859847aa6c5d10f15d9180f9f1ee75f9c29a07b..ed90be6b31e986d356a0c1dfc18a6cc96fff7eff 100644 (file)
@@ -15,7 +15,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_isPow2_64_DEFINED
-        static inline bool isPow2_64( atomic64_unaligned x )
+        static inline bool isPow2_64( uint64_t x )
         {
             return (x & ( x - 1 )) == 0 && x;
         }
@@ -67,7 +67,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_msb64_DEFINED
-        static inline int msb64( atomic64u_unaligned x )
+        static inline int msb64( uint64_t x )
         {
             uint32_t h = (uint32_t) (x >> 32);
             if ( h )
@@ -77,7 +77,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_msb64nz_DEFINED
-        static inline int msb64nz( atomic64u_unaligned x )
+        static inline int msb64nz( uint64_t x )
         {
             return msb64( x ) - 1;
         }
@@ -129,7 +129,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_lsb64_DEFINED
-        static inline int lsb64( atomic64u_unaligned x )
+        static inline int lsb64( uint64_t x )
         {
             if ( !x )
                 return 0;
@@ -140,7 +140,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_lsb64nz_DEFINED
-        static inline int lsb64nz( atomic64u_unaligned x )
+        static inline int lsb64nz( uint64_t x )
         {
             return lsb64( x ) - 1;
         }
@@ -166,10 +166,10 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_rbo64_DEFINED
-        static inline atomic64u_t rbo64( atomic64u_unaligned x )
+        static inline uint64_t rbo64( uint64_t x )
         {
             //                      Low 32bit                                          Hight 32bit
-            return ( ((atomic64u_t) rbo32( (uint32_t) x )) << 32 ) | ((atomic64u_t) rbo32( (uint32_t) (x >> 32) ));
+            return ( static_cast<uint64_t>(rbo32( (uint32_t) x )) << 32 ) | ( static_cast<uint64_t>( rbo32( (uint32_t) (x >> 32) )));
         }
 #endif
 
@@ -191,7 +191,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_sbc64_DEFINED
-        static inline int sbc64( atomic64u_unaligned x )
+        static inline int sbc64( uint64_t x )
         {
 #        ifdef cds_beans_zbc64_DEFINED
             return 64 - zbc64( x );
@@ -212,7 +212,7 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_zbc64_DEFINED
-        static inline int zbc64( atomic64u_unaligned x )
+        static inline int zbc64( uint64_t x )
         {
             return 64 - sbc64( x );
         }
@@ -230,11 +230,11 @@ namespace cds {
 #endif
 
 #ifndef cds_bitop_complement64_DEFINED
-        static inline bool complement64( atomic64u_t * pArg, unsigned int nBit )
+        static inline bool complement64( uint64_t * pArg, unsigned int nBit )
         {
             assert( pArg );
-            atomic64u_t nVal = *pArg & (atomic64u_t(1) << nBit);
-            *pArg ^= atomic64u_t(1) << nBit;
+            uint64_t nVal = *pArg & (uint64_t(1) << nBit);
+            *pArg ^= uint64_t(1) << nBit;
             return nVal != 0;
         }
 #endif
@@ -257,8 +257,8 @@ namespace cds {
 
         static inline uint64_t RandXorShift64(uint64_t x)
         {
-            //static atomic64u_t xRandom = 88172645463325252LL;
-            //atomic64u_t x = xRandom;
+            //static uint64_t xRandom = 88172645463325252LL;
+            //uint64_t x = xRandom;
             if ( !x )
                 x = 88172645463325252LL;
             x ^= x << 13;
index a7769cb3f559bb6e0033cdf36467e25754ac71a9..4f59333008c293b257793e48cb6b5f4efa76709c 100644 (file)
@@ -346,29 +346,6 @@ namespace cds {}
 #   define CDS_CXX11_INLINE_NAMESPACE
 #endif
 
-//@cond
-// typedefs for back compatibility
-namespace cds {
-    /// 64bit unaligned int
-    typedef int64_t     atomic64_unaligned;
-
-    /// 64bit unaligned unsigned int
-    typedef uint64_t  atomic64u_unaligned;
-
-    /// 64bit aligned int
-    typedef atomic64_unaligned CDS_TYPE_ALIGNMENT(8)    atomic64_aligned;
-
-    /// 64bit aligned unsigned int
-    typedef atomic64u_unaligned CDS_TYPE_ALIGNMENT(8)   atomic64u_aligned;
-
-    /// 64bit atomic int (aligned)
-    typedef atomic64_aligned    atomic64_t;
-
-    /// 64bit atomic unsigned int (aligned)
-    typedef atomic64u_aligned   atomic64u_t;
-} // namespace cds
-//@endcond
-
 /*************************************************************************
  Common things
 **************************************************************************/
index 8b4adbf3e5eab8ab3e921eab7acbfb6578d15541..b8e61530b6b1bf9a627f05d89404ebc920289be4 100644 (file)
@@ -682,7 +682,7 @@ namespace cds { namespace intrusive {
 
         /// Finds \p key using \p pred predicate for searching
         /**
-            The function is an analog of \ref cds_intrusive_MichaelList_rcu_find_func "find(Q&, Func)"
+            The function is an analog of \p find(Q&, Func)
             but \p pred is used for key comparing.
             \p Less functor has the interface like \p std::less.
             \p pred must imply the same element order as the comparator used for building the list.
index 0271139504076b99a6f9d7b2e55414780b5d40c0..9ef279b03ac309b39722ae6e82d486eb98e6d045 100644 (file)
@@ -430,13 +430,13 @@ namespace michael {
         size_t      nPageDeallocCount   ;  ///< Count of page (superblock) deallocated
         size_t      nDescAllocCount     ;  ///< Count of superblock descriptors
         size_t      nDescFull           ;  ///< Count of full superblock
-        atomic64u_t nBytesAllocated     ;  ///< Count of allocated bytes (for heap managed memory blocks)
-        atomic64u_t nBytesDeallocated   ;  ///< Count of deallocated bytes (for heap managed memory blocks)
+        uint64_t    nBytesAllocated     ;  ///< Count of allocated bytes (for heap managed memory blocks)
+        uint64_t    nBytesDeallocated   ;  ///< Count of deallocated bytes (for heap managed memory blocks)
 
         size_t      nSysAllocCount      ;  ///< Count of \p alloc and \p alloc_aligned function call (for large memory blocks that allocated directly from OS)
         size_t      nSysFreeCount       ;  ///< Count of \p free and \p free_aligned function call (for large memory blocks that allocated directly from OS)
-        atomic64u_t nSysBytesAllocated  ;  ///< Count of allocated bytes (for large memory blocks that allocated directly from OS)
-        atomic64_t  nSysBytesDeallocated;  ///< Count of deallocated bytes (for large memory blocks that allocated directly from OS)
+        uint64_t    nSysBytesAllocated  ;  ///< Count of allocated bytes (for large memory blocks that allocated directly from OS)
+        int64_t     nSysBytesDeallocated;  ///< Count of deallocated bytes (for large memory blocks that allocated directly from OS)
 
         // Internal contention indicators
         /// CAS failure counter for updating active field of active block of \p alloc_from_active Heap internal function
index 21752d2454468656033d75118254ba7ff90875f9..7b9ba9735a321f83bc89618bf3b122b151ad6238 100644 (file)
@@ -14,7 +14,7 @@ namespace cds { namespace memory { namespace michael {
         class bound_checker
         {
         protected:
-            typedef atomic64u_t trailer_type;
+            typedef uint64_t trailer_type;
             static const trailer_type s_BoundCheckerTrailer = 0xbadcafeedeadc0feULL;
 
         public:
index 0ceae2878ac08162a986f54223ace0a11c4fe482..0477f7d764e520243b62317083853dec332853bd 100644 (file)
@@ -51,13 +51,13 @@ namespace cds { namespace memory { namespace michael {
         }
 
         /// Returns current value of nBytesAllocated counter
-        atomic64u_t allocatedBytes() const
+        uint64_t allocatedBytes() const
         {
             return nBytesAllocated.load(atomics::memory_order_relaxed);
         }
 
         /// Returns current value of nBytesAllocated counter
-        atomic64u_t deallocatedBytes() const
+        uint64_t deallocatedBytes() const
         {
             return nBytesDeallocated.load(atomics::memory_order_relaxed);
         }
@@ -92,13 +92,13 @@ namespace cds { namespace memory { namespace michael {
         }
 
         /// Returns current value of nBytesAllocated counter
-        atomic64u_t allocatedBytes() const
+        uint64_t allocatedBytes() const
         {
             return 0;
         }
 
         /// Returns current value of nBytesAllocated counter
-        atomic64u_t deallocatedBytes() const
+        uint64_t deallocatedBytes() const
         {
             return 0;
         }
index e7b0e7b5c0314b2b0374ace8d1791cbc38d20612..d8b8148568540335e6d80e87b08b90e2be31c7a0 100644 (file)
@@ -247,7 +247,7 @@ namespace cds { namespace memory { namespace michael {
             To get count of bytes allocated but not yet deallocated you should call
             \code allocatedBytes() - deallocatedBytes() \endcode
         */
-        atomic64u_t allocatedBytes() const
+        uint64_t allocatedBytes() const
         {
             return nBytesAllocated.load(atomics::memory_order_relaxed);
         }
@@ -258,7 +258,7 @@ namespace cds { namespace memory { namespace michael {
 
             See \ref allocatedBytes notes
         */
-        atomic64u_t deallocatedBytes() const
+        uint64_t deallocatedBytes() const
         {
             return nBytesDeallocated.load(atomics::memory_order_relaxed);
         }
@@ -370,9 +370,9 @@ namespace cds { namespace memory { namespace michael {
         { return 0; }
         size_t descFull() const
         { return 0; }
-        atomic64u_t allocatedBytes() const
+        uint64_t allocatedBytes() const
         { return 0; }
-        atomic64u_t deallocatedBytes() const
+        uint64_t deallocatedBytes() const
         { return 0; }
         size_t activeDescCASFailureCount() const
         { return 0; }
index 11e01a0a072dfb9590d6435bcc3f63cff01e8cba..2e52fa7182f98ec12605d805538c8c6540b00258 100644 (file)
         2011.01.23 khizmax  Created
 */
 
+#include <stdlib.h> // rand, srand
+
 #include <cds/details/aligned_type.h>
 #include <cds/user_setup/allocator.h>
 #include <cds/user_setup/cache_line.h>
 #include <cds/algo/atomic.h>
-#include <stdlib.h> // rand, srand
 
 namespace cds {
 
index e224b627f7f0e4f033c0aaf79d65a3a33fa3fb26..81e543be63b3bb8ef9f2e9f1bda0f0d4e9a5da8a 100644 (file)
@@ -32,7 +32,7 @@ protected:
 
     void bitop64()
     {
-        cds::atomic64u_t    n;
+        uint64_t n;
         n = 0;
         CPPUNIT_ASSERT_EX( cds::bitop::MSB(n) == 0, "n=" << n );
         CPPUNIT_ASSERT_EX( cds::bitop::LSB(n) == 0, "n=" << n );