author | ppunegov |
Wed, 17 Aug 2016 18:48:34 +0300 | |
changeset 41335 | 27115e2e42cc |
parent 40655 | 9f644073d3a0 |
child 46402 | 8147e17ad6fa |
permissions | -rw-r--r-- |
1 | 1 |
/* |
37264
d9b0f2b53b73
8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range
sangheki
parents:
37059
diff
changeset
|
2 |
* Copyright (c) 2005, 2016, 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 |
} |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
52 |
const bm_word_t cur_val = (bm_word_t) Atomic::cmpxchg_ptr((void*) new_val, |
1 | 53 |
(volatile void*) addr, |
54 |
(void*) old_val); |
|
55 |
if (cur_val == old_val) { |
|
56 |
return true; // Success. |
|
57 |
} |
|
58 |
old_val = cur_val; // The value changed, try again. |
|
59 |
} while (true); |
|
60 |
} |
|
61 |
||
62 |
inline bool BitMap::par_clear_bit(idx_t bit) { |
|
63 |
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
|
64 |
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
|
65 |
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
|
66 |
bm_word_t old_val = *addr; |
1 | 67 |
|
68 |
do { |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
69 |
const bm_word_t new_val = old_val & mask; |
1 | 70 |
if (new_val == old_val) { |
71 |
return false; // Someone else beat us to it. |
|
72 |
} |
|
19998
c18a7b05127a
8024914: Swapped usage of idx_t and bm_word_t types in bitMap.inline.hpp
tschatzl
parents:
11574
diff
changeset
|
73 |
const bm_word_t cur_val = (bm_word_t) Atomic::cmpxchg_ptr((void*) new_val, |
1 | 74 |
(volatile void*) addr, |
75 |
(void*) old_val); |
|
76 |
if (cur_val == old_val) { |
|
77 |
return true; // Success. |
|
78 |
} |
|
79 |
old_val = cur_val; // The value changed, try again. |
|
80 |
} while (true); |
|
81 |
} |
|
82 |
||
1374 | 83 |
inline void BitMap::set_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
84 |
if (hint == small_range && end - beg == 1) { |
|
85 |
set_bit(beg); |
|
86 |
} else { |
|
87 |
if (hint == large_range) { |
|
88 |
set_large_range(beg, end); |
|
89 |
} else { |
|
90 |
set_range(beg, end); |
|
91 |
} |
|
92 |
} |
|
93 |
} |
|
94 |
||
95 |
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
|
96 |
if (end - beg == 1) { |
1374 | 97 |
clear_bit(beg); |
98 |
} else { |
|
99 |
if (hint == large_range) { |
|
100 |
clear_large_range(beg, end); |
|
101 |
} else { |
|
102 |
clear_range(beg, end); |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
106 |
||
107 |
inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
|
108 |
if (hint == small_range && end - beg == 1) { |
|
109 |
par_at_put(beg, true); |
|
110 |
} else { |
|
111 |
if (hint == large_range) { |
|
112 |
par_at_put_large_range(beg, end, true); |
|
113 |
} else { |
|
114 |
par_at_put_range(beg, end, true); |
|
115 |
} |
|
116 |
} |
|
117 |
} |
|
1 | 118 |
|
1374 | 119 |
inline void BitMap::set_range_of_words(idx_t beg, idx_t end) { |
120 |
bm_word_t* map = _map; |
|
26937 | 121 |
for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0; |
1374 | 122 |
} |
123 |
||
38177 | 124 |
inline void BitMap::clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end) { |
1374 | 125 |
for (idx_t i = beg; i < end; ++i) map[i] = 0; |
126 |
} |
|
127 |
||
38177 | 128 |
inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { |
129 |
clear_range_of_words(_map, beg, end); |
|
130 |
} |
|
1374 | 131 |
|
132 |
inline void BitMap::clear() { |
|
133 |
clear_range_of_words(0, size_in_words()); |
|
134 |
} |
|
135 |
||
136 |
inline void BitMap::par_clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { |
|
137 |
if (hint == small_range && end - beg == 1) { |
|
138 |
par_at_put(beg, false); |
|
139 |
} else { |
|
140 |
if (hint == large_range) { |
|
141 |
par_at_put_large_range(beg, end, false); |
|
142 |
} else { |
|
143 |
par_at_put_range(beg, end, false); |
|
144 |
} |
|
145 |
} |
|
146 |
} |
|
147 |
||
148 |
inline BitMap::idx_t |
|
149 |
BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const { |
|
150 |
assert(l_offset <= size(), "BitMap index out of bounds"); |
|
151 |
assert(r_offset <= size(), "BitMap index out of bounds"); |
|
152 |
assert(l_offset <= r_offset, "l_offset > r_offset ?"); |
|
153 |
||
154 |
if (l_offset == r_offset) { |
|
155 |
return l_offset; |
|
156 |
} |
|
157 |
idx_t index = word_index(l_offset); |
|
158 |
idx_t r_index = word_index(r_offset-1) + 1; |
|
159 |
idx_t res_offset = l_offset; |
|
1 | 160 |
|
161 |
// check bits including and to the _left_ of offset's position |
|
1374 | 162 |
idx_t pos = bit_in_word(res_offset); |
26937 | 163 |
bm_word_t res = map(index) >> pos; |
164 |
if (res != 0) { |
|
1 | 165 |
// find the position of the 1-bit |
1374 | 166 |
for (; !(res & 1); res_offset++) { |
1 | 167 |
res = res >> 1; |
168 |
} |
|
11574
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
169 |
|
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
170 |
#ifdef ASSERT |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
171 |
// 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
|
172 |
// 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
|
173 |
// strong and will trip the assert. |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
174 |
// |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
175 |
// 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
|
176 |
// 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
|
177 |
// 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
|
178 |
// 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
|
179 |
// 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
|
180 |
// 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
|
181 |
// |
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
182 |
// 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
|
183 |
// 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
|
184 |
// 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
|
185 |
// 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
|
186 |
// 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
|
187 |
// 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
|
188 |
// 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
|
189 |
|
8a7fe61966c0
7121547: G1: High number mispredicted branches while iterating over the marking bitmap
johnc
parents:
7397
diff
changeset
|
190 |
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
|
191 |
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
|
192 |
#endif // ASSERT |
1374 | 193 |
return MIN2(res_offset, r_offset); |
1 | 194 |
} |
195 |
// skip over all word length 0-bit runs |
|
196 |
for (index++; index < r_index; index++) { |
|
197 |
res = map(index); |
|
26937 | 198 |
if (res != 0) { |
1 | 199 |
// found a 1, return the offset |
1374 | 200 |
for (res_offset = bit_index(index); !(res & 1); res_offset++) { |
1 | 201 |
res = res >> 1; |
202 |
} |
|
203 |
assert(res & 1, "tautology; see loop condition"); |
|
1374 | 204 |
assert(res_offset >= l_offset, "just checking"); |
205 |
return MIN2(res_offset, r_offset); |
|
206 |
} |
|
207 |
} |
|
208 |
return r_offset; |
|
209 |
} |
|
210 |
||
211 |
inline BitMap::idx_t |
|
212 |
BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const { |
|
213 |
assert(l_offset <= size(), "BitMap index out of bounds"); |
|
214 |
assert(r_offset <= size(), "BitMap index out of bounds"); |
|
215 |
assert(l_offset <= r_offset, "l_offset > r_offset ?"); |
|
216 |
||
217 |
if (l_offset == r_offset) { |
|
218 |
return l_offset; |
|
219 |
} |
|
220 |
idx_t index = word_index(l_offset); |
|
221 |
idx_t r_index = word_index(r_offset-1) + 1; |
|
222 |
idx_t res_offset = l_offset; |
|
223 |
||
224 |
// check bits including and to the _left_ of offset's position |
|
225 |
idx_t pos = res_offset & (BitsPerWord - 1); |
|
26937 | 226 |
bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos); |
1374 | 227 |
|
26937 | 228 |
if (res != ~(bm_word_t)0) { |
1374 | 229 |
// find the position of the 0-bit |
230 |
for (; res & 1; res_offset++) { |
|
231 |
res = res >> 1; |
|
232 |
} |
|
233 |
assert(res_offset >= l_offset, "just checking"); |
|
234 |
return MIN2(res_offset, r_offset); |
|
235 |
} |
|
236 |
// skip over all word length 1-bit runs |
|
237 |
for (index++; index < r_index; index++) { |
|
238 |
res = map(index); |
|
26937 | 239 |
if (res != ~(bm_word_t)0) { |
1374 | 240 |
// found a 0, return the offset |
241 |
for (res_offset = index << LogBitsPerWord; res & 1; |
|
242 |
res_offset++) { |
|
243 |
res = res >> 1; |
|
244 |
} |
|
245 |
assert(!(res & 1), "tautology; see loop condition"); |
|
246 |
assert(res_offset >= l_offset, "just checking"); |
|
247 |
return MIN2(res_offset, r_offset); |
|
1 | 248 |
} |
249 |
} |
|
1374 | 250 |
return r_offset; |
251 |
} |
|
252 |
||
253 |
inline BitMap::idx_t |
|
254 |
BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset, |
|
255 |
idx_t r_offset) const |
|
256 |
{ |
|
257 |
verify_range(l_offset, r_offset); |
|
258 |
assert(bit_in_word(r_offset) == 0, "r_offset not word-aligned"); |
|
259 |
||
260 |
if (l_offset == r_offset) { |
|
261 |
return l_offset; |
|
262 |
} |
|
263 |
idx_t index = word_index(l_offset); |
|
264 |
idx_t r_index = word_index(r_offset); |
|
265 |
idx_t res_offset = l_offset; |
|
266 |
||
267 |
// check bits including and to the _left_ of offset's position |
|
26937 | 268 |
bm_word_t res = map(index) >> bit_in_word(res_offset); |
269 |
if (res != 0) { |
|
1374 | 270 |
// find the position of the 1-bit |
271 |
for (; !(res & 1); res_offset++) { |
|
272 |
res = res >> 1; |
|
273 |
} |
|
274 |
assert(res_offset >= l_offset && |
|
275 |
res_offset < r_offset, "just checking"); |
|
276 |
return res_offset; |
|
277 |
} |
|
278 |
// skip over all word length 0-bit runs |
|
279 |
for (index++; index < r_index; index++) { |
|
280 |
res = map(index); |
|
26937 | 281 |
if (res != 0) { |
1374 | 282 |
// found a 1, return the offset |
283 |
for (res_offset = bit_index(index); !(res & 1); res_offset++) { |
|
284 |
res = res >> 1; |
|
285 |
} |
|
286 |
assert(res & 1, "tautology; see loop condition"); |
|
287 |
assert(res_offset >= l_offset && res_offset < r_offset, "just checking"); |
|
288 |
return res_offset; |
|
289 |
} |
|
290 |
} |
|
291 |
return r_offset; |
|
1 | 292 |
} |
1374 | 293 |
|
294 |
||
295 |
// Returns a bit mask for a range of bits [beg, end) within a single word. Each |
|
296 |
// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The |
|
297 |
// returned mask can be used directly to clear the range, or inverted to set the |
|
298 |
// range. Note: end must not be 0. |
|
299 |
inline BitMap::bm_word_t |
|
300 |
BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const { |
|
301 |
assert(end != 0, "does not work when end == 0"); |
|
302 |
assert(beg == end || word_index(beg) == word_index(end - 1), |
|
303 |
"must be a single-word range"); |
|
304 |
bm_word_t mask = bit_mask(beg) - 1; // low (right) bits |
|
305 |
if (bit_in_word(end) != 0) { |
|
306 |
mask |= ~(bit_mask(end) - 1); // high (left) bits |
|
307 |
} |
|
308 |
return mask; |
|
309 |
} |
|
310 |
||
311 |
inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) { |
|
26937 | 312 |
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t)); |
1374 | 313 |
} |
314 |
||
315 |
inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) { |
|
26937 | 316 |
memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t)); |
1374 | 317 |
} |
318 |
||
319 |
inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const { |
|
320 |
idx_t bit_rounded_up = bit + (BitsPerWord - 1); |
|
321 |
// Check for integer arithmetic overflow. |
|
322 |
return bit_rounded_up > bit ? word_index(bit_rounded_up) : size_in_words(); |
|
323 |
} |
|
324 |
||
325 |
inline BitMap::idx_t BitMap::get_next_one_offset(idx_t l_offset, |
|
326 |
idx_t r_offset) const { |
|
327 |
return get_next_one_offset_inline(l_offset, r_offset); |
|
328 |
} |
|
329 |
||
330 |
inline BitMap::idx_t BitMap::get_next_zero_offset(idx_t l_offset, |
|
331 |
idx_t r_offset) const { |
|
332 |
return get_next_zero_offset_inline(l_offset, r_offset); |
|
333 |
} |
|
334 |
||
37059
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
335 |
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
|
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 |
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
|
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 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
|
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 |
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
|
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::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
|
346 |
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
|
347 |
_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
|
348 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
349 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
350 |
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
|
351 |
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
|
352 |
_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
|
353 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
354 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
355 |
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
|
356 |
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
|
357 |
_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
|
358 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
359 |
|
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
360 |
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
|
361 |
verify_bit_within_slot_index(bit_within_slot_index); |
38177 | 362 |
|
363 |
idx_t bit = bit_index(slot_index, bit_within_slot_index); |
|
364 |
if (bit >= _map.size()) { |
|
365 |
_map.resize(2 * MAX2(_map.size(), bit)); |
|
366 |
} |
|
367 |
_map.at_put(bit, value); |
|
37059
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
368 |
} |
c482915a21aa
8151440: Move BitMap verfication inline functions out from bitMap.hpp
stefank
parents:
26937
diff
changeset
|
369 |
|
7397 | 370 |
#endif // SHARE_VM_UTILITIES_BITMAP_INLINE_HPP |