1.1 --- a/src/share/vm/memory/blockOffsetTable.hpp Thu Apr 22 13:23:15 2010 -0700 1.2 +++ b/src/share/vm/memory/blockOffsetTable.hpp Mon May 03 10:24:51 2010 -0700 1.3 @@ -140,14 +140,38 @@ 1.4 "right address out of range"); 1.5 assert(left < right, "Heap addresses out of order"); 1.6 size_t num_cards = pointer_delta(right, left) >> LogN_words; 1.7 - memset(&_offset_array[index_for(left)], offset, num_cards); 1.8 + 1.9 + // Below, we may use an explicit loop instead of memset() 1.10 + // because on certain platforms memset() can give concurrent 1.11 + // readers "out-of-thin-air," phantom zeros; see 6948537. 1.12 + if (UseMemSetInBOT) { 1.13 + memset(&_offset_array[index_for(left)], offset, num_cards); 1.14 + } else { 1.15 + size_t i = index_for(left); 1.16 + const size_t end = i + num_cards; 1.17 + for (; i < end; i++) { 1.18 + _offset_array[i] = offset; 1.19 + } 1.20 + } 1.21 } 1.22 1.23 void set_offset_array(size_t left, size_t right, u_char offset) { 1.24 assert(right < _vs.committed_size(), "right address out of range"); 1.25 assert(left <= right, "indexes out of order"); 1.26 size_t num_cards = right - left + 1; 1.27 - memset(&_offset_array[left], offset, num_cards); 1.28 + 1.29 + // Below, we may use an explicit loop instead of memset 1.30 + // because on certain platforms memset() can give concurrent 1.31 + // readers "out-of-thin-air," phantom zeros; see 6948537. 1.32 + if (UseMemSetInBOT) { 1.33 + memset(&_offset_array[left], offset, num_cards); 1.34 + } else { 1.35 + size_t i = left; 1.36 + const size_t end = i + num_cards; 1.37 + for (; i < end; i++) { 1.38 + _offset_array[i] = offset; 1.39 + } 1.40 + } 1.41 } 1.42 1.43 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {