97
97
// Use the largest type your platform is comfortable doing atomic ops with.
98
98
// TODO: rdar://11477843
99
99
typedef unsigned long bitmap_t ;
100
- #if defined(__LP64__ )
101
- #define BYTES_PER_BITMAP 8
102
- #else
103
- #define BYTES_PER_BITMAP 4
104
- #endif
105
100
106
101
#define BITMAP_C (v ) ((bitmap_t)(v))
107
102
#define BITMAP_ALL_ONES (~BITMAP_C(0))
108
103
109
104
// Stop configuring.
110
105
111
- #define CONTINUATIONS_PER_BITMAP (BYTES_PER_BITMAP * 8)
106
+ #define CONTINUATIONS_PER_BITMAP (sizeof(bitmap_t) * 8)
112
107
#define BITMAPS_PER_SUPERMAP (BYTES_PER_SUPERMAP * 8)
113
108
114
109
#define BYTES_PER_MAGAZINE (PAGES_PER_MAGAZINE * DISPATCH_ALLOCATOR_PAGE_SIZE)
115
- #define CONSUMED_BYTES_PER_BITMAP (BYTES_PER_BITMAP + \
110
+ #define CONSUMED_BYTES_PER_BITMAP (sizeof(bitmap_t) + \
116
111
(DISPATCH_CONTINUATION_SIZE * CONTINUATIONS_PER_BITMAP))
117
112
118
- #define BYTES_PER_SUPERMAP BYTES_PER_BITMAP
113
+ #define BYTES_PER_SUPERMAP sizeof(bitmap_t)
119
114
#define CONSUMED_BYTES_PER_SUPERMAP (BYTES_PER_SUPERMAP + \
120
115
(BITMAPS_PER_SUPERMAP * CONSUMED_BYTES_PER_BITMAP))
121
116
@@ -138,8 +133,8 @@ typedef unsigned long bitmap_t;
138
133
// this will round up such that first_bitmap_in_same_page() can mask the address
139
134
// of a bitmap_t in the maps to obtain the first bitmap for that same page
140
135
#define ROUND_UP_TO_BITMAP_ALIGNMENT (x ) \
141
- (((x) + ((BITMAPS_PER_PAGE * BYTES_PER_BITMAP ) - 1u)) & \
142
- ~((BITMAPS_PER_PAGE * BYTES_PER_BITMAP ) - 1u))
136
+ (((x) + ((BITMAPS_PER_PAGE * sizeof(bitmap_t) ) - 1u)) & \
137
+ ~((BITMAPS_PER_PAGE * sizeof(bitmap_t) ) - 1u))
143
138
// Since these are both powers of two, we end up with not only the max alignment,
144
139
// but happily the least common multiple, which will be the greater of the two.
145
140
#define ROUND_UP_TO_BITMAP_ALIGNMENT_AND_CONTINUATION_SIZE (x ) (ROUND_UP_TO_CONTINUATION_SIZE(ROUND_UP_TO_BITMAP_ALIGNMENT(x)))
@@ -148,7 +143,7 @@ typedef unsigned long bitmap_t;
148
143
#define PADDING_TO_CONTINUATION_SIZE (x ) (ROUND_UP_TO_CONTINUATION_SIZE(x) - (x))
149
144
150
145
#define SIZEOF_SUPERMAPS (BYTES_PER_SUPERMAP * SUPERMAPS_PER_MAGAZINE)
151
- #define SIZEOF_MAPS (BYTES_PER_BITMAP * BITMAPS_PER_SUPERMAP * \
146
+ #define SIZEOF_MAPS (sizeof(bitmap_t) * BITMAPS_PER_SUPERMAP * \
152
147
SUPERMAPS_PER_MAGAZINE)
153
148
154
149
// header is expected to end on supermap's required alignment
@@ -171,7 +166,7 @@ typedef unsigned long bitmap_t;
171
166
#define REMAINDER_IN_FIRST_PAGE (BYTES_LEFT_IN_FIRST_PAGE - \
172
167
(FULL_BITMAPS_IN_FIRST_PAGE * CONSUMED_BYTES_PER_BITMAP) - \
173
168
(FULL_BITMAPS_IN_FIRST_PAGE ? 0 : \
174
- ROUND_UP_TO_CONTINUATION_SIZE(BYTES_PER_BITMAP )))
169
+ ROUND_UP_TO_CONTINUATION_SIZE(sizeof(bitmap_t) )))
175
170
176
171
#define REMAINDERED_CONTINUATIONS_IN_FIRST_PAGE \
177
172
(REMAINDER_IN_FIRST_PAGE / DISPATCH_CONTINUATION_SIZE)
@@ -181,7 +176,7 @@ typedef unsigned long bitmap_t;
181
176
(REMAINDERED_CONTINUATIONS_IN_FIRST_PAGE == 0 ? 0 : 1))
182
177
183
178
#define FPMAPS_TO_FPCONTS_PADDING (PADDING_TO_CONTINUATION_SIZE(\
184
- BYTES_PER_BITMAP * BITMAPS_IN_FIRST_PAGE))
179
+ sizeof(bitmap_t) * BITMAPS_IN_FIRST_PAGE))
185
180
186
181
#else // PACK_FIRST_PAGE_WITH_CONTINUATIONS
187
182
0 commit comments