src/share/vm/utilities/bitMap.cpp
Print this page
*** 342,352 ****
bm_word_t* other_map = other.map();
idx_t size = size_in_words();
for (idx_t index = 0; index < size; index++) {
idx_t temp = map(index) | other_map[index];
changed = changed || (temp != map(index));
! map()[index] = temp;
}
return changed;
}
--- 342,352 ----
bm_word_t* other_map = other.map();
idx_t size = size_in_words();
for (idx_t index = 0; index < size; index++) {
idx_t temp = map(index) | other_map[index];
changed = changed || (temp != map(index));
! dest_map[index] = temp;
}
return changed;
}
*** 405,429 ****
bool BitMap::is_full() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
! if (*word != (bm_word_t) AllBits) return false;
word++;
}
! return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits;
}
bool BitMap::is_empty() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
! if (*word != (bm_word_t) NoBits) return false;
word++;
}
! return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits;
}
void BitMap::clear_large() {
clear_large_range_of_words(0, size_in_words());
}
--- 405,429 ----
bool BitMap::is_full() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
! if (*word != ~(bm_word_t)0) return false;
word++;
}
! return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0;
}
bool BitMap::is_empty() const {
bm_word_t* word = map();
idx_t rest = size();
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
! if (*word != 0) return false;
word++;
}
! return rest == 0 || (*word & right_n_bits((int)rest)) == 0;
}
void BitMap::clear_large() {
clear_large_range_of_words(0, size_in_words());
}
*** 439,449 ****
idx_t endIndex = MIN2(word_index(rightOffset) + 1, size_in_words());
for (idx_t index = startIndex, offset = leftOffset;
offset < rightOffset && index < endIndex;
offset = (++index) << LogBitsPerWord) {
idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
! for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) {
if (rest & 1) {
if (!blk->do_bit(offset)) return false;
// resample at each closure application
// (see, for instance, CMS bug 4525989)
rest = map(index) >> (offset & (BitsPerWord -1));
--- 439,449 ----
idx_t endIndex = MIN2(word_index(rightOffset) + 1, size_in_words());
for (idx_t index = startIndex, offset = leftOffset;
offset < rightOffset && index < endIndex;
offset = (++index) << LogBitsPerWord) {
idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
! for (; offset < rightOffset && rest != 0; offset++) {
if (rest & 1) {
if (!blk->do_bit(offset)) return false;
// resample at each closure application
// (see, for instance, CMS bug 4525989)
rest = map(index) >> (offset & (BitsPerWord -1));
*** 466,476 ****
intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table,
(intptr_t*) &_pop_count_table,
(intptr_t) NULL_WORD);
if (res != NULL_WORD) {
guarantee( _pop_count_table == (void*) res, "invariant" );
! FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal);
}
}
}
BitMap::idx_t BitMap::num_set_bits(bm_word_t w) {
--- 466,476 ----
intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table,
(intptr_t*) &_pop_count_table,
(intptr_t) NULL_WORD);
if (res != NULL_WORD) {
guarantee( _pop_count_table == (void*) res, "invariant" );
! FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
}
}
}
BitMap::idx_t BitMap::num_set_bits(bm_word_t w) {