mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
6948537: CMS: BOT walkers observe out-of-thin-air zeros on sun4v sparc/CMT
On sun4v/CMT avoid use of memset() in BOT updates so as to prevent concurrent BOT readers from seeing the phantom zeros arising from memset()'s use of BIS. Reviewed-by: jmasa, johnc, minqi, poonam, tonyp
This commit is contained in:
parent
99196ff9ca
commit
762f60d343
4 changed files with 44 additions and 2 deletions
|
@ -140,14 +140,38 @@ class BlockOffsetSharedArray: public CHeapObj {
|
|||
"right address out of range");
|
||||
assert(left < right, "Heap addresses out of order");
|
||||
size_t num_cards = pointer_delta(right, left) >> LogN_words;
|
||||
memset(&_offset_array[index_for(left)], offset, num_cards);
|
||||
|
||||
// Below, we may use an explicit loop instead of memset()
|
||||
// because on certain platforms memset() can give concurrent
|
||||
// readers "out-of-thin-air," phantom zeros; see 6948537.
|
||||
if (UseMemSetInBOT) {
|
||||
memset(&_offset_array[index_for(left)], offset, num_cards);
|
||||
} else {
|
||||
size_t i = index_for(left);
|
||||
const size_t end = i + num_cards;
|
||||
for (; i < end; i++) {
|
||||
_offset_array[i] = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void set_offset_array(size_t left, size_t right, u_char offset) {
|
||||
assert(right < _vs.committed_size(), "right address out of range");
|
||||
assert(left <= right, "indexes out of order");
|
||||
size_t num_cards = right - left + 1;
|
||||
memset(&_offset_array[left], offset, num_cards);
|
||||
|
||||
// Below, we may use an explicit loop instead of memset
|
||||
// because on certain platforms memset() can give concurrent
|
||||
// readers "out-of-thin-air," phantom zeros; see 6948537.
|
||||
if (UseMemSetInBOT) {
|
||||
memset(&_offset_array[left], offset, num_cards);
|
||||
} else {
|
||||
size_t i = left;
|
||||
const size_t end = i + num_cards;
|
||||
for (; i < end; i++) {
|
||||
_offset_array[i] = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue