author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 46958 | hotspot/src/share/vm/utilities/bitMap.inline.hpp@a13bd8c6b7a2 |
child 52394 | 96bd0f70ef99 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46402 | 2 |
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_UTILITIES_BITMAP_INLINE_HPP |
26 |
#define SHARE_VM_UTILITIES_BITMAP_INLINE_HPP |
|
27 |
||
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
39219
diff
changeset
|
28 |
#include "runtime/atomic.hpp" |
7397 | 29 |
#include "utilities/bitMap.hpp" |
30 |
||
1374 | 31 |
inline void BitMap::set_bit(idx_t bit) { |
32 |
verify_index(bit); |
|
33 |
*word_addr(bit) |= bit_mask(bit); |
|
34 |
} |
|
35 |
||
36 |
inline void BitMap::clear_bit(idx_t bit) { |
|
37 |
verify_index(bit); |
|
38 |
*word_addr(bit) &= ~bit_mask(bit); |
|
39 |
} |
|
40 |
||
1 | 41 |
inline bool BitMap::par_set_bit(idx_t bit) { |
42 |
verify_index(bit); |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
43 |
volatile bm_word_t* const addr = word_addr(bit); |
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
44 |
const bm_word_t mask = bit_mask(bit); |
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
45 |
bm_word_t old_val = *addr; |
1 | 46 |
|
47 |
do { |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
48 |
const bm_word_t new_val = old_val | mask; |
1 | 49 |
if (new_val == old_val) { |
50 |
return false; // Someone else beat us to it. |
|
51 |
} |
|
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46428
diff
changeset
|
52 |
const bm_word_t cur_val = Atomic::cmpxchg(new_val, addr, old_val); |
1 | 53 |
if (cur_val == old_val) { |
54 |
return true; // Success. |
|
55 |
} |
|
56 |
old_val = cur_val; // The value changed, try again. |
|
57 |
} while (true); |
|
58 |
} |
|
59 |
||
60 |
inline bool BitMap::par_clear_bit(idx_t bit) { |
|
61 |
verify_index(bit); |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
62 |
volatile bm_word_t* const addr = word_addr(bit); |
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
63 |
const bm_word_t mask = ~bit_mask(bit); |
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
64 |
bm_word_t old_val = *addr; |
1 | 65 |
|
66 |
do { |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
67 |
const bm_word_t new_val = old_val & mask; |
1 | 68 |
if (new_val == old_val) { |
69 |
return false; // Someone else beat us to it. |
|
70 |
} |
|
46958
a13bd8c6b7a2
8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents:
46428
diff
changeset
|
71 |
const bm_word_t cur_val = Atomic::cmpxchg(new_val, addr, old_val); |
1 | 72 |
if (cur_val == old_val) { |
73 |
return true; // Success. |
|
74 |
} |
|
75 |
old_val = cur_val; // The value changed, try again. |
|
76 |
} while (true); |
|
77 |
} |
|
78 |
||
1374 | 79 |
inline void BitMap::set_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
80 |
if (hint == small_range && end - beg == 1) { |
|
81 |
set_bit(beg); |
|
82 |
} else { |
|
83 |
if (hint == large_range) { |
|
84 |
set_large_range(beg, end); |
|
85 |
} else { |
|
86 |
set_range(beg, end); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
||
91 |
inline void BitMap::clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
|
37264
d9b0f2b53b73
8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents:
37059
diff
changeset
|
92 |
if (end - beg == 1) { |
1374 | 93 |
clear_bit(beg); |
94 |
} else { |
|
95 |
if (hint == large_range) { |
|
96 |
clear_large_range(beg, end); |
|
97 |
} else { |
|
98 |
clear_range(beg, end); |
|
99 |
} |
|
100 |
} |
|
101 |
} |
|
102 |
||
103 |
inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
|
104 |
if (hint == small_range && end - beg == 1) { |
|
105 |
par_at_put(beg, true); |
|
106 |
} else { |
|
107 |
if (hint == large_range) { |
|
108 |
par_at_put_large_range(beg, end, true); |
|
109 |
} else { |
|
110 |
par_at_put_range(beg, end, true); |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
1 | 114 |
|
1374 | 115 |
inline void BitMap::set_range_of_words(idx_t beg, idx_t end) { |
116 |
bm_word_t* map = _map; |
|
26937 | 117 |
for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0; |
1374 | 118 |
} |
119 |
||
38177 | 120 |
inline void BitMap::clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end) { |
1374 | 121 |
for (idx_t i = beg; i < end; ++i) map[i] = 0; |
122 |
} |
|
123 |
||
38177 | 124 |
inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { |
125 |
clear_range_of_words(_map, beg, end); |
|
126 |
} |
|
1374 | 127 |
|
128 |
inline void BitMap::clear() { |
|
129 |
clear_range_of_words(0, size_in_words()); |
|
130 |
} |
|
131 |
||
132 |
inline void BitMap::par_clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
|
133 |
if (hint == small_range && end - beg == 1) { |
|
134 |
par_at_put(beg, false); |
|
135 |
} else { |
|
136 |
if (hint == large_range) { |
|
137 |
par_at_put_large_range(beg, end, false); |
|
138 |
} else { |
|
139 |
par_at_put_range(beg, end, false); |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
||
144 |
inline BitMap::idx_t |
|
46402 | 145 |
BitMap::get_next_one_offset(idx_t l_offset, idx_t r_offset) const { |
1374 | 146 |
assert(l_offset <= size(), "BitMap index out of bounds"); |
147 |
assert(r_offset <= size(), "BitMap index out of bounds"); |
|
148 |
assert(l_offset <= r_offset, "l_offset > r_offset ?"); |
|
149 |
||
150 |
if (l_offset == r_offset) { |
|
151 |
return l_offset; |
|
152 |
} |
|
153 |
idx_t index = word_index(l_offset); |
|
154 |
idx_t r_index = word_index(r_offset-1) + 1; |
|
155 |
idx_t res_offset = l_offset; |
|
1 | 156 |
|
157 |
// check bits including and to the _left_ of offset's position |
|
1374 | 158 |
idx_t pos = bit_in_word(res_offset); |
26937 | 159 |
bm_word_t res = map(index) >> pos; |
160 |
if (res != 0) { |
|
1 | 161 |
// find the position of the 1-bit |
1374 | 162 |
for (; !(res & 1); res_offset++) { |
1 | 163 |
res = res >> 1; |
164 |
} |
|
11574
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
165 |
|
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
166 |
#ifdef ASSERT |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
167 |
// In the following assert, if r_offset is not bitamp word aligned, |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
168 |
// checking that res_offset is strictly less than r_offset is too |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
169 |
// strong and will trip the assert. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
170 |
// |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
171 |
// Consider the case where l_offset is bit 15 and r_offset is bit 17 |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
172 |
// of the same map word, and where bits [15:16:17:18] == [00:00:00:01]. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
173 |
// All the bits in the range [l_offset:r_offset) are 0. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
174 |
// The loop that calculates res_offset, above, would yield the offset |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
175 |
// of bit 18 because it's in the same map word as l_offset and there |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
176 |
// is a set bit in that map word above l_offset (i.e. res != NoBits). |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
177 |
// |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
178 |
// In this case, however, we can assert is that res_offset is strictly |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
179 |
// less than size() since we know that there is at least one set bit |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
180 |
// at an offset above, but in the same map word as, r_offset. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
181 |
// Otherwise, if r_offset is word aligned then it will not be in the |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
182 |
// same map word as l_offset (unless it equals l_offset). So either |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
183 |
// there won't be a set bit between l_offset and the end of it's map |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
184 |
// word (i.e. res == NoBits), or res_offset will be less than r_offset. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
185 |
|
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
186 |
idx_t limit = is_word_aligned(r_offset) ? r_offset : size(); |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
187 |
assert(res_offset >= l_offset && res_offset < limit, "just checking"); |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
188 |
#endif // ASSERT |
1374 | 189 |
return MIN2(res_offset, r_offset); |
1 | 190 |
} |
191 |
// skip over all word length 0-bit runs |
|
192 |
for (index++; index < r_index; index++) { |
|
193 |
res = map(index); |
|
26937 | 194 |
if (res != 0) { |
1 | 195 |
// found a 1, return the offset |
1374 | 196 |
for (res_offset = bit_index(index); !(res & 1); res_offset++) { |
1 | 197 |
res = res >> 1; |
198 |
} |
|
199 |
assert(res & 1, "tautology; see loop condition"); |
|
1374 | 200 |
assert(res_offset >= l_offset, "just checking"); |
201 |
return MIN2(res_offset, r_offset); |
|
202 |
} |
|
203 |
} |
|
204 |
return r_offset; |
|
205 |
} |
|
206 |
||
207 |
inline BitMap::idx_t |
|
46402 | 208 |
BitMap::get_next_zero_offset(idx_t l_offset, idx_t r_offset) const { |
1374 | 209 |
assert(l_offset <= size(), "BitMap index out of bounds"); |
210 |
assert(r_offset <= size(), "BitMap index out of bounds"); |
|
211 |
assert(l_offset <= r_offset, "l_offset > r_offset ?"); |
|
212 |
||
213 |
if (l_offset == r_offset) { |
|
214 |
return l_offset; |
|
215 |
} |
|
216 |
idx_t index = word_index(l_offset); |
|
217 |
idx_t r_index = word_index(r_offset-1) + 1; |
|
218 |
idx_t res_offset = l_offset; |
|
219 |
||
220 |
// check bits including and to the _left_ of offset's position |
|
46428
d577822ca75c
8178352: BitMap::get_next_zero_offset may give wrong result on Mac
kbarrett
parents:
46402
diff
changeset
|
221 |
idx_t pos = bit_in_word(res_offset); |
d577822ca75c
8178352: BitMap::get_next_zero_offset may give wrong result on Mac
kbarrett
parents:
46402
diff
changeset
|
222 |
bm_word_t res = ~map(index) >> pos; // flip bits and shift for l_offset |
1374 | 223 |
|
46428
d577822ca75c
8178352: BitMap::get_next_zero_offset may give wrong result on Mac
kbarrett
parents:
46402
diff
changeset
|
224 |
if (res != 0) { |
d577822ca75c
8178352: BitMap::get_next_zero_offset may give wrong result on Mac
kbarrett
parents:
46402
diff
changeset
|
225 |
// find the position of the 1-bit |
d577822ca75c
8178352: BitMap::get_next_zero_offset may give wrong result on Mac
kbarrett
parents:
46402
diff
changeset
|
226 |
for (; !(res & 1); res_offset++) { |
1374 | 227 |
res = res >> 1; |
228 |
} |
|
229 |
assert(res_offset >= l_offset, "just checking"); |
|
230 |
return MIN2(res_offset, r_offset); |
|
231 |
} |
|
232 |
// skip over all word length 1-bit runs |
|
233 |
for (index++; index < r_index; index++) { |
|
234 |
res = map(index); |
|
26937 | 235 |
if (res != ~(bm_word_t)0) { |
1374 | 236 |
// found a 0, return the offset |
237 |
for (res_offset = index << LogBitsPerWord; res & 1; |
|
238 |
res_offset++) { |
|
239 |
res = res >> 1; |
|
240 |
} |
|
241 |
assert(!(res & 1), "tautology; see loop condition"); |
|
242 |
assert(res_offset >= l_offset, "just checking"); |
|
243 |
return MIN2(res_offset, r_offset); |
|
1 | 244 |
} |
245 |
} |
|
1374 | 246 |
return r_offset; |
247 |
} |
|
248 |
||
249 |
inline BitMap::idx_t |
|
46402 | 250 |
BitMap::get_next_one_offset_aligned_right(idx_t l_offset, idx_t r_offset) const |
1374 | 251 |
{ |
252 |
verify_range(l_offset, r_offset); |
|
253 |
assert(bit_in_word(r_offset) == 0, "r_offset not word-aligned"); |
|
254 |
||
255 |
if (l_offset == r_offset) { |
|
256 |
return l_offset; |
|
257 |
} |
|
258 |
idx_t index = word_index(l_offset); |
|
259 |
idx_t r_index = word_index(r_offset); |
|
260 |
idx_t res_offset = l_offset; |
|
261 |
||
262 |
// check bits including and to the _left_ of offset's position |
|
26937 | 263 |
bm_word_t res = map(index) >> bit_in_word(res_offset); |
264 |
if (res != 0) { |
|
1374 | 265 |
// find the position of the 1-bit |
266 |
for (; !(res & 1); res_offset++) { |
|
267 |
res = res >> 1; |
|
268 |
} |
|
269 |
assert(res_offset >= l_offset && |
|
270 |
res_offset < r_offset, "just checking"); |
|
271 |
return res_offset; |
|
272 |
} |
|
273 |
// skip over all word length 0-bit runs |
|
274 |
for (index++; index < r_index; index++) { |
|
275 |
res = map(index); |
|
26937 | 276 |
if (res != 0) { |
1374 | 277 |
// found a 1, return the offset |
278 |
for (res_offset = bit_index(index); !(res & 1); res_offset++) { |
|
279 |
res = res >> 1; |
|
280 |
} |
|
281 |
assert(res & 1, "tautology; see loop condition"); |
|
282 |
assert(res_offset >= l_offset && res_offset < r_offset, "just checking"); |
|
283 |
return res_offset; |
|
284 |
} |
|
285 |
} |
|
286 |
return r_offset; |
|
1 | 287 |
} |
1374 | 288 |
|
289 |
||
290 |
// Returns a bit mask for a range of bits [beg, end) within a single word. Each |
|
291 |
// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The |
|
292 |
// returned mask can be used directly to clear the range, or inverted to set the |
|
293 |
// range. Note: end must not be 0. |
|
294 |
inline BitMap::bm_word_t |
|
295 |
BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const { |
|
296 |
assert(end != 0, "does not work when end == 0"); |
|
297 |
assert(beg == end || word_index(beg) == word_index(end - 1), |
|
298 |
"must be a single-word range"); |
|
299 |
bm_word_t mask = bit_mask(beg) - 1; // low (right) bits |
|
300 |
if (bit_in_word(end) != 0) { |
|
301 |
mask |= ~(bit_mask(end) - 1); // high (left) bits |
|
302 |
} |
|
303 |
return mask; |
|
304 |
} |
|
305 |
||
306 |
inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) { |
|
26937 | 307 |
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t)); |
1374 | 308 |
} |
309 |
||
310 |
inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) { |
|
26937 | 311 |
memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t)); |
1374 | 312 |
} |
313 |
||
314 |
inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const { |
|
315 |
idx_t bit_rounded_up = bit + (BitsPerWord - 1); |
|
316 |
// Check for integer arithmetic overflow. |
|
317 |
return bit_rounded_up > bit ? word_index(bit_rounded_up) : size_in_words(); |
|
318 |
} |
|
319 |
||
37059
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
320 |
inline bool BitMap2D::is_valid_index(idx_t slot_index, idx_t bit_within_slot_index) { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
321 |
verify_bit_within_slot_index(bit_within_slot_index); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
322 |
return (bit_index(slot_index, bit_within_slot_index) < size_in_bits()); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
323 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
324 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
325 |
inline bool BitMap2D::at(idx_t slot_index, idx_t bit_within_slot_index) const { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
326 |
verify_bit_within_slot_index(bit_within_slot_index); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
327 |
return _map.at(bit_index(slot_index, bit_within_slot_index)); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
328 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
329 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
330 |
inline void BitMap2D::set_bit(idx_t slot_index, idx_t bit_within_slot_index) { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
331 |
verify_bit_within_slot_index(bit_within_slot_index); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
332 |
_map.set_bit(bit_index(slot_index, bit_within_slot_index)); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
333 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
334 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
335 |
inline void BitMap2D::clear_bit(idx_t slot_index, idx_t bit_within_slot_index) { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
336 |
verify_bit_within_slot_index(bit_within_slot_index); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
337 |
_map.clear_bit(bit_index(slot_index, bit_within_slot_index)); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
338 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
339 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
340 |
inline void BitMap2D::at_put(idx_t slot_index, idx_t bit_within_slot_index, bool value) { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
341 |
verify_bit_within_slot_index(bit_within_slot_index); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
342 |
_map.at_put(bit_index(slot_index, bit_within_slot_index), value); |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
343 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
344 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
345 |
inline void BitMap2D::at_put_grow(idx_t slot_index, idx_t bit_within_slot_index, bool value) { |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
346 |
verify_bit_within_slot_index(bit_within_slot_index); |
38177 | 347 |
|
348 |
idx_t bit = bit_index(slot_index, bit_within_slot_index); |
|
349 |
if (bit >= _map.size()) { |
|
350 |
_map.resize(2 * MAX2(_map.size(), bit)); |
|
351 |
} |
|
352 |
_map.at_put(bit, value); |
|
37059
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
353 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
354 |
|
7397 | 355 |
#endif // SHARE_VM_UTILITIES_BITMAP_INLINE_HPP |