Mercurial > hg > truffle
annotate src/share/vm/utilities/bitMap.cpp @ 17541:4aa6fa2864af
Merge
author | asaha |
---|---|
date | Thu, 23 Jan 2014 14:50:08 -0800 |
parents | 55fb97c4c58d |
children | 3dc1055f4e87 abec000618bf |
rev | line source |
---|---|
0 | 1 /* |
17467
55fb97c4c58d
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
10992
diff
changeset
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
844
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "memory/allocation.inline.hpp" | |
27 #include "utilities/bitMap.inline.hpp" | |
28 #include "utilities/copy.hpp" | |
29 #ifdef TARGET_OS_FAMILY_linux | |
30 # include "os_linux.inline.hpp" | |
31 #endif | |
32 #ifdef TARGET_OS_FAMILY_solaris | |
33 # include "os_solaris.inline.hpp" | |
34 #endif | |
35 #ifdef TARGET_OS_FAMILY_windows | |
36 # include "os_windows.inline.hpp" | |
37 #endif | |
3960 | 38 #ifdef TARGET_OS_FAMILY_bsd |
39 # include "os_bsd.inline.hpp" | |
40 #endif | |
0 | 41 |
42 | |
342 | 43 BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : |
10992 | 44 _map(map), _size(size_in_bits), _map_allocator(false) |
342 | 45 { |
46 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); | |
0 | 47 assert(size_in_bits >= 0, "just checking"); |
48 } | |
49 | |
50 | |
342 | 51 BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : |
10992 | 52 _map(NULL), _size(0), _map_allocator(false) |
342 | 53 { |
54 assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); | |
55 resize(size_in_bits, in_resource_area); | |
0 | 56 } |
57 | |
342 | 58 void BitMap::resize(idx_t size_in_bits, bool in_resource_area) { |
0 | 59 assert(size_in_bits >= 0, "just checking"); |
342 | 60 idx_t old_size_in_words = size_in_words(); |
61 bm_word_t* old_map = map(); | |
62 | |
0 | 63 _size = size_in_bits; |
342 | 64 idx_t new_size_in_words = size_in_words(); |
65 if (in_resource_area) { | |
66 _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); | |
67 } else { | |
10992 | 68 if (old_map != NULL) { |
69 _map_allocator.free(); | |
70 } | |
71 _map = _map_allocator.allocate(new_size_in_words); | |
342 | 72 } |
73 Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, | |
74 MIN2(old_size_in_words, new_size_in_words)); | |
0 | 75 if (new_size_in_words > old_size_in_words) { |
76 clear_range_of_words(old_size_in_words, size_in_words()); | |
77 } | |
78 } | |
79 | |
80 void BitMap::set_range_within_word(idx_t beg, idx_t end) { | |
81 // With a valid range (beg <= end), this test ensures that end != 0, as | |
82 // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. | |
83 if (beg != end) { | |
342 | 84 bm_word_t mask = inverted_bit_mask_for_range(beg, end); |
0 | 85 *word_addr(beg) |= ~mask; |
86 } | |
87 } | |
88 | |
89 void BitMap::clear_range_within_word(idx_t beg, idx_t end) { | |
90 // With a valid range (beg <= end), this test ensures that end != 0, as | |
91 // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. | |
92 if (beg != end) { | |
342 | 93 bm_word_t mask = inverted_bit_mask_for_range(beg, end); |
0 | 94 *word_addr(beg) &= mask; |
95 } | |
96 } | |
97 | |
98 void BitMap::par_put_range_within_word(idx_t beg, idx_t end, bool value) { | |
99 assert(value == 0 || value == 1, "0 for clear, 1 for set"); | |
100 // With a valid range (beg <= end), this test ensures that end != 0, as | |
101 // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. | |
102 if (beg != end) { | |
103 intptr_t* pw = (intptr_t*)word_addr(beg); | |
104 intptr_t w = *pw; | |
105 intptr_t mr = (intptr_t)inverted_bit_mask_for_range(beg, end); | |
106 intptr_t nw = value ? (w | ~mr) : (w & mr); | |
107 while (true) { | |
108 intptr_t res = Atomic::cmpxchg_ptr(nw, pw, w); | |
109 if (res == w) break; | |
110 w = *pw; | |
111 nw = value ? (w | ~mr) : (w & mr); | |
112 } | |
113 } | |
114 } | |
115 | |
116 void BitMap::set_range(idx_t beg, idx_t end) { | |
117 verify_range(beg, end); | |
118 | |
119 idx_t beg_full_word = word_index_round_up(beg); | |
120 idx_t end_full_word = word_index(end); | |
121 | |
122 if (beg_full_word < end_full_word) { | |
123 // The range includes at least one full word. | |
124 set_range_within_word(beg, bit_index(beg_full_word)); | |
125 set_range_of_words(beg_full_word, end_full_word); | |
126 set_range_within_word(bit_index(end_full_word), end); | |
127 } else { | |
128 // The range spans at most 2 partial words. | |
129 idx_t boundary = MIN2(bit_index(beg_full_word), end); | |
130 set_range_within_word(beg, boundary); | |
131 set_range_within_word(boundary, end); | |
132 } | |
133 } | |
134 | |
135 void BitMap::clear_range(idx_t beg, idx_t end) { | |
136 verify_range(beg, end); | |
137 | |
138 idx_t beg_full_word = word_index_round_up(beg); | |
139 idx_t end_full_word = word_index(end); | |
140 | |
141 if (beg_full_word < end_full_word) { | |
142 // The range includes at least one full word. | |
143 clear_range_within_word(beg, bit_index(beg_full_word)); | |
144 clear_range_of_words(beg_full_word, end_full_word); | |
145 clear_range_within_word(bit_index(end_full_word), end); | |
146 } else { | |
147 // The range spans at most 2 partial words. | |
148 idx_t boundary = MIN2(bit_index(beg_full_word), end); | |
149 clear_range_within_word(beg, boundary); | |
150 clear_range_within_word(boundary, end); | |
151 } | |
152 } | |
153 | |
154 void BitMap::set_large_range(idx_t beg, idx_t end) { | |
155 verify_range(beg, end); | |
156 | |
157 idx_t beg_full_word = word_index_round_up(beg); | |
158 idx_t end_full_word = word_index(end); | |
159 | |
160 assert(end_full_word - beg_full_word >= 32, | |
161 "the range must include at least 32 bytes"); | |
162 | |
163 // The range includes at least one full word. | |
164 set_range_within_word(beg, bit_index(beg_full_word)); | |
165 set_large_range_of_words(beg_full_word, end_full_word); | |
166 set_range_within_word(bit_index(end_full_word), end); | |
167 } | |
168 | |
169 void BitMap::clear_large_range(idx_t beg, idx_t end) { | |
170 verify_range(beg, end); | |
171 | |
172 idx_t beg_full_word = word_index_round_up(beg); | |
173 idx_t end_full_word = word_index(end); | |
174 | |
175 assert(end_full_word - beg_full_word >= 32, | |
176 "the range must include at least 32 bytes"); | |
177 | |
178 // The range includes at least one full word. | |
179 clear_range_within_word(beg, bit_index(beg_full_word)); | |
180 clear_large_range_of_words(beg_full_word, end_full_word); | |
181 clear_range_within_word(bit_index(end_full_word), end); | |
182 } | |
183 | |
184 void BitMap::at_put(idx_t offset, bool value) { | |
185 if (value) { | |
186 set_bit(offset); | |
187 } else { | |
188 clear_bit(offset); | |
189 } | |
190 } | |
191 | |
192 // Return true to indicate that this thread changed | |
193 // the bit, false to indicate that someone else did. | |
194 // In either case, the requested bit is in the | |
195 // requested state some time during the period that | |
196 // this thread is executing this call. More importantly, | |
197 // if no other thread is executing an action to | |
198 // change the requested bit to a state other than | |
199 // the one that this thread is trying to set it to, | |
200 // then the the bit is in the expected state | |
201 // at exit from this method. However, rather than | |
202 // make such a strong assertion here, based on | |
203 // assuming such constrained use (which though true | |
204 // today, could change in the future to service some | |
205 // funky parallel algorithm), we encourage callers | |
206 // to do such verification, as and when appropriate. | |
207 bool BitMap::par_at_put(idx_t bit, bool value) { | |
208 return value ? par_set_bit(bit) : par_clear_bit(bit); | |
209 } | |
210 | |
211 void BitMap::at_put_grow(idx_t offset, bool value) { | |
212 if (offset >= size()) { | |
213 resize(2 * MAX2(size(), offset)); | |
214 } | |
215 at_put(offset, value); | |
216 } | |
217 | |
218 void BitMap::at_put_range(idx_t start_offset, idx_t end_offset, bool value) { | |
219 if (value) { | |
220 set_range(start_offset, end_offset); | |
221 } else { | |
222 clear_range(start_offset, end_offset); | |
223 } | |
224 } | |
225 | |
226 void BitMap::par_at_put_range(idx_t beg, idx_t end, bool value) { | |
227 verify_range(beg, end); | |
228 | |
229 idx_t beg_full_word = word_index_round_up(beg); | |
230 idx_t end_full_word = word_index(end); | |
231 | |
232 if (beg_full_word < end_full_word) { | |
233 // The range includes at least one full word. | |
234 par_put_range_within_word(beg, bit_index(beg_full_word), value); | |
235 if (value) { | |
236 set_range_of_words(beg_full_word, end_full_word); | |
237 } else { | |
238 clear_range_of_words(beg_full_word, end_full_word); | |
239 } | |
240 par_put_range_within_word(bit_index(end_full_word), end, value); | |
241 } else { | |
242 // The range spans at most 2 partial words. | |
243 idx_t boundary = MIN2(bit_index(beg_full_word), end); | |
244 par_put_range_within_word(beg, boundary, value); | |
245 par_put_range_within_word(boundary, end, value); | |
246 } | |
247 | |
248 } | |
249 | |
250 void BitMap::at_put_large_range(idx_t beg, idx_t end, bool value) { | |
251 if (value) { | |
252 set_large_range(beg, end); | |
253 } else { | |
254 clear_large_range(beg, end); | |
255 } | |
256 } | |
257 | |
258 void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) { | |
259 verify_range(beg, end); | |
260 | |
261 idx_t beg_full_word = word_index_round_up(beg); | |
262 idx_t end_full_word = word_index(end); | |
263 | |
264 assert(end_full_word - beg_full_word >= 32, | |
265 "the range must include at least 32 bytes"); | |
266 | |
267 // The range includes at least one full word. | |
268 par_put_range_within_word(beg, bit_index(beg_full_word), value); | |
269 if (value) { | |
270 set_large_range_of_words(beg_full_word, end_full_word); | |
271 } else { | |
272 clear_large_range_of_words(beg_full_word, end_full_word); | |
273 } | |
274 par_put_range_within_word(bit_index(end_full_word), end, value); | |
275 } | |
276 | |
277 bool BitMap::contains(const BitMap other) const { | |
278 assert(size() == other.size(), "must have same size"); | |
342 | 279 bm_word_t* dest_map = map(); |
280 bm_word_t* other_map = other.map(); | |
0 | 281 idx_t size = size_in_words(); |
282 for (idx_t index = 0; index < size_in_words(); index++) { | |
342 | 283 bm_word_t word_union = dest_map[index] | other_map[index]; |
0 | 284 // If this has more bits set than dest_map[index], then other is not a |
285 // subset. | |
286 if (word_union != dest_map[index]) return false; | |
287 } | |
288 return true; | |
289 } | |
290 | |
291 bool BitMap::intersects(const BitMap other) const { | |
292 assert(size() == other.size(), "must have same size"); | |
342 | 293 bm_word_t* dest_map = map(); |
294 bm_word_t* other_map = other.map(); | |
0 | 295 idx_t size = size_in_words(); |
296 for (idx_t index = 0; index < size_in_words(); index++) { | |
297 if ((dest_map[index] & other_map[index]) != 0) return true; | |
298 } | |
299 // Otherwise, no intersection. | |
300 return false; | |
301 } | |
302 | |
303 void BitMap::set_union(BitMap other) { | |
304 assert(size() == other.size(), "must have same size"); | |
342 | 305 bm_word_t* dest_map = map(); |
306 bm_word_t* other_map = other.map(); | |
0 | 307 idx_t size = size_in_words(); |
308 for (idx_t index = 0; index < size_in_words(); index++) { | |
309 dest_map[index] = dest_map[index] | other_map[index]; | |
310 } | |
311 } | |
312 | |
313 | |
314 void BitMap::set_difference(BitMap other) { | |
315 assert(size() == other.size(), "must have same size"); | |
342 | 316 bm_word_t* dest_map = map(); |
317 bm_word_t* other_map = other.map(); | |
0 | 318 idx_t size = size_in_words(); |
319 for (idx_t index = 0; index < size_in_words(); index++) { | |
320 dest_map[index] = dest_map[index] & ~(other_map[index]); | |
321 } | |
322 } | |
323 | |
324 | |
325 void BitMap::set_intersection(BitMap other) { | |
326 assert(size() == other.size(), "must have same size"); | |
342 | 327 bm_word_t* dest_map = map(); |
328 bm_word_t* other_map = other.map(); | |
0 | 329 idx_t size = size_in_words(); |
330 for (idx_t index = 0; index < size; index++) { | |
331 dest_map[index] = dest_map[index] & other_map[index]; | |
332 } | |
333 } | |
334 | |
335 | |
342 | 336 void BitMap::set_intersection_at_offset(BitMap other, idx_t offset) { |
337 assert(other.size() >= offset, "offset not in range"); | |
338 assert(other.size() - offset >= size(), "other not large enough"); | |
339 // XXX Ideally, we would remove this restriction. | |
340 guarantee((offset % (sizeof(bm_word_t) * BitsPerByte)) == 0, | |
341 "Only handle aligned cases so far."); | |
342 bm_word_t* dest_map = map(); | |
343 bm_word_t* other_map = other.map(); | |
344 idx_t offset_word_ind = word_index(offset); | |
345 idx_t size = size_in_words(); | |
346 for (idx_t index = 0; index < size; index++) { | |
347 dest_map[index] = dest_map[index] & other_map[offset_word_ind + index]; | |
348 } | |
349 } | |
350 | |
0 | 351 bool BitMap::set_union_with_result(BitMap other) { |
352 assert(size() == other.size(), "must have same size"); | |
353 bool changed = false; | |
342 | 354 bm_word_t* dest_map = map(); |
355 bm_word_t* other_map = other.map(); | |
0 | 356 idx_t size = size_in_words(); |
357 for (idx_t index = 0; index < size; index++) { | |
358 idx_t temp = map(index) | other_map[index]; | |
359 changed = changed || (temp != map(index)); | |
360 map()[index] = temp; | |
361 } | |
362 return changed; | |
363 } | |
364 | |
365 | |
366 bool BitMap::set_difference_with_result(BitMap other) { | |
367 assert(size() == other.size(), "must have same size"); | |
368 bool changed = false; | |
342 | 369 bm_word_t* dest_map = map(); |
370 bm_word_t* other_map = other.map(); | |
0 | 371 idx_t size = size_in_words(); |
372 for (idx_t index = 0; index < size; index++) { | |
342 | 373 bm_word_t temp = dest_map[index] & ~(other_map[index]); |
0 | 374 changed = changed || (temp != dest_map[index]); |
375 dest_map[index] = temp; | |
376 } | |
377 return changed; | |
378 } | |
379 | |
380 | |
381 bool BitMap::set_intersection_with_result(BitMap other) { | |
382 assert(size() == other.size(), "must have same size"); | |
383 bool changed = false; | |
342 | 384 bm_word_t* dest_map = map(); |
385 bm_word_t* other_map = other.map(); | |
0 | 386 idx_t size = size_in_words(); |
387 for (idx_t index = 0; index < size; index++) { | |
342 | 388 bm_word_t orig = dest_map[index]; |
389 bm_word_t temp = orig & other_map[index]; | |
0 | 390 changed = changed || (temp != orig); |
391 dest_map[index] = temp; | |
392 } | |
393 return changed; | |
394 } | |
395 | |
396 | |
397 void BitMap::set_from(BitMap other) { | |
398 assert(size() == other.size(), "must have same size"); | |
342 | 399 bm_word_t* dest_map = map(); |
400 bm_word_t* other_map = other.map(); | |
0 | 401 idx_t size = size_in_words(); |
402 for (idx_t index = 0; index < size; index++) { | |
403 dest_map[index] = other_map[index]; | |
404 } | |
405 } | |
406 | |
407 | |
408 bool BitMap::is_same(BitMap other) { | |
409 assert(size() == other.size(), "must have same size"); | |
342 | 410 bm_word_t* dest_map = map(); |
411 bm_word_t* other_map = other.map(); | |
0 | 412 idx_t size = size_in_words(); |
413 for (idx_t index = 0; index < size; index++) { | |
414 if (dest_map[index] != other_map[index]) return false; | |
415 } | |
416 return true; | |
417 } | |
418 | |
419 bool BitMap::is_full() const { | |
342 | 420 bm_word_t* word = map(); |
0 | 421 idx_t rest = size(); |
422 for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { | |
342 | 423 if (*word != (bm_word_t) AllBits) return false; |
0 | 424 word++; |
425 } | |
342 | 426 return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits; |
0 | 427 } |
428 | |
429 | |
430 bool BitMap::is_empty() const { | |
342 | 431 bm_word_t* word = map(); |
0 | 432 idx_t rest = size(); |
433 for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { | |
342 | 434 if (*word != (bm_word_t) NoBits) return false; |
0 | 435 word++; |
436 } | |
342 | 437 return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits; |
0 | 438 } |
439 | |
440 void BitMap::clear_large() { | |
441 clear_large_range_of_words(0, size_in_words()); | |
442 } | |
443 | |
444 // Note that if the closure itself modifies the bitmap | |
445 // then modifications in and to the left of the _bit_ being | |
446 // currently sampled will not be seen. Note also that the | |
447 // interval [leftOffset, rightOffset) is right open. | |
342 | 448 bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) { |
0 | 449 verify_range(leftOffset, rightOffset); |
450 | |
451 idx_t startIndex = word_index(leftOffset); | |
452 idx_t endIndex = MIN2(word_index(rightOffset) + 1, size_in_words()); | |
453 for (idx_t index = startIndex, offset = leftOffset; | |
454 offset < rightOffset && index < endIndex; | |
455 offset = (++index) << LogBitsPerWord) { | |
456 idx_t rest = map(index) >> (offset & (BitsPerWord - 1)); | |
342 | 457 for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) { |
0 | 458 if (rest & 1) { |
342 | 459 if (!blk->do_bit(offset)) return false; |
0 | 460 // resample at each closure application |
461 // (see, for instance, CMS bug 4525989) | |
462 rest = map(index) >> (offset & (BitsPerWord -1)); | |
463 } | |
464 rest = rest >> 1; | |
465 } | |
466 } | |
342 | 467 return true; |
468 } | |
469 | |
470 BitMap::idx_t* BitMap::_pop_count_table = NULL; | |
471 | |
472 void BitMap::init_pop_count_table() { | |
473 if (_pop_count_table == NULL) { | |
6197 | 474 BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256, mtInternal); |
342 | 475 for (uint i = 0; i < 256; i++) { |
476 table[i] = num_set_bits(i); | |
477 } | |
478 | |
479 intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table, | |
480 (intptr_t*) &_pop_count_table, | |
481 (intptr_t) NULL_WORD); | |
482 if (res != NULL_WORD) { | |
483 guarantee( _pop_count_table == (void*) res, "invariant" ); | |
6197 | 484 FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal); |
342 | 485 } |
486 } | |
0 | 487 } |
488 | |
342 | 489 BitMap::idx_t BitMap::num_set_bits(bm_word_t w) { |
490 idx_t bits = 0; | |
0 | 491 |
342 | 492 while (w != 0) { |
493 while ((w & 1) == 0) { | |
494 w >>= 1; | |
0 | 495 } |
342 | 496 bits++; |
497 w >>= 1; | |
0 | 498 } |
342 | 499 return bits; |
0 | 500 } |
501 | |
342 | 502 BitMap::idx_t BitMap::num_set_bits_from_table(unsigned char c) { |
503 assert(_pop_count_table != NULL, "precondition"); | |
504 return _pop_count_table[c]; | |
505 } | |
0 | 506 |
342 | 507 BitMap::idx_t BitMap::count_one_bits() const { |
508 init_pop_count_table(); // If necessary. | |
509 idx_t sum = 0; | |
510 typedef unsigned char uchar; | |
511 for (idx_t i = 0; i < size_in_words(); i++) { | |
512 bm_word_t w = map()[i]; | |
513 for (size_t j = 0; j < sizeof(bm_word_t); j++) { | |
514 sum += num_set_bits_from_table(uchar(w & 255)); | |
515 w >>= 8; | |
0 | 516 } |
517 } | |
342 | 518 return sum; |
0 | 519 } |
520 | |
9076
7b835924c31c
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
6197
diff
changeset
|
521 void BitMap::print_on_error(outputStream* st, const char* prefix) const { |
7b835924c31c
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
6197
diff
changeset
|
522 st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")", |
7b835924c31c
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
6197
diff
changeset
|
523 prefix, map(), (char*)map() + (size() >> LogBitsPerByte)); |
7b835924c31c
8011872: Include Bit Map addresses in the hs_err files
stefank
parents:
6197
diff
changeset
|
524 } |
342 | 525 |
0 | 526 #ifndef PRODUCT |
527 | |
528 void BitMap::print_on(outputStream* st) const { | |
529 tty->print("Bitmap(%d):", size()); | |
530 for (idx_t index = 0; index < size(); index++) { | |
531 tty->print("%c", at(index) ? '1' : '0'); | |
532 } | |
533 tty->cr(); | |
534 } | |
535 | |
536 #endif | |
537 | |
538 | |
342 | 539 BitMap2D::BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot) |
0 | 540 : _bits_per_slot(bits_per_slot) |
541 , _map(map, size_in_slots * bits_per_slot) | |
542 { | |
543 } | |
544 | |
545 | |
546 BitMap2D::BitMap2D(idx_t size_in_slots, idx_t bits_per_slot) | |
547 : _bits_per_slot(bits_per_slot) | |
548 , _map(size_in_slots * bits_per_slot) | |
549 { | |
550 } |