Chris@16
|
1 // Copyright (C) 2009 Tim Blechmann
|
Chris@16
|
2 //
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
4 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6
|
Chris@16
|
7 #ifndef BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
|
Chris@16
|
8 #define BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
|
Chris@16
|
9
|
Chris@16
|
10 /* this file defines the following macros:
|
Chris@16
|
11 BOOST_LOCKFREE_CACHELINE_BYTES: size of a cache line
|
Chris@16
|
12 BOOST_LOCKFREE_PTR_COMPRESSION: use tag/pointer compression to utilize parts
|
Chris@16
|
13 of the virtual address space as tag (at least 16bit)
|
Chris@16
|
14 BOOST_LOCKFREE_DCAS_ALIGNMENT: symbol used for aligning structs at cache line
|
Chris@16
|
15 boundaries
|
Chris@16
|
16 */
|
Chris@16
|
17
|
Chris@16
|
18 #define BOOST_LOCKFREE_CACHELINE_BYTES 64
|
Chris@16
|
19
|
Chris@16
|
20 #ifdef _MSC_VER
|
Chris@16
|
21
|
Chris@16
|
22 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __declspec(align(BOOST_LOCKFREE_CACHELINE_BYTES))
|
Chris@16
|
23
|
Chris@16
|
24 #if defined(_M_IX86)
|
Chris@16
|
25 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
|
Chris@16
|
26 #elif defined(_M_X64) || defined(_M_IA64)
|
Chris@16
|
27 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
|
Chris@16
|
28 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __declspec(align(16))
|
Chris@16
|
29 #endif
|
Chris@16
|
30
|
Chris@16
|
31 #endif /* _MSC_VER */
|
Chris@16
|
32
|
Chris@16
|
33 #ifdef __GNUC__
|
Chris@16
|
34
|
Chris@16
|
35 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(BOOST_LOCKFREE_CACHELINE_BYTES)))
|
Chris@16
|
36
|
Chris@16
|
37 #if defined(__i386__) || defined(__ppc__)
|
Chris@16
|
38 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
|
Chris@16
|
39 #elif defined(__x86_64__)
|
Chris@16
|
40 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
|
Chris@16
|
41 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16)))
|
Chris@16
|
42 #elif defined(__alpha__)
|
Chris@16
|
43 // LATER: alpha may benefit from pointer compression. but what is the maximum size of the address space?
|
Chris@16
|
44 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
|
Chris@16
|
45 #endif
|
Chris@16
|
46 #endif /* __GNUC__ */
|
Chris@16
|
47
|
Chris@16
|
48 #ifndef BOOST_LOCKFREE_DCAS_ALIGNMENT
|
Chris@16
|
49 #define BOOST_LOCKFREE_DCAS_ALIGNMENT /*BOOST_LOCKFREE_DCAS_ALIGNMENT*/
|
Chris@16
|
50 #endif
|
Chris@16
|
51
|
Chris@16
|
52 #ifndef BOOST_LOCKFREE_CACHELINE_ALIGNMENT
|
Chris@16
|
53 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT /*BOOST_LOCKFREE_CACHELINE_ALIGNMENT*/
|
Chris@16
|
54 #endif
|
Chris@16
|
55
|
Chris@16
|
56 #endif /* BOOST_LOCKFREE_PREFIX_HPP_INCLUDED */
|