Mercurial > hg > graal-compiler
comparison src/share/vm/memory/blockOffsetTable.hpp @ 1518:3bfae429e2cf
6948537: CMS: BOT walkers observe out-of-thin-air zeros on sun4v sparc/CMT
Summary: 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
author | ysr |
---|---|
date | Mon, 03 May 2010 10:24:51 -0700 |
parents | bd02caa94611 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1490:f03d0a26bf83 | 1518:3bfae429e2cf |
---|---|
138 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { | 138 void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { |
139 assert(index_for(right - 1) < _vs.committed_size(), | 139 assert(index_for(right - 1) < _vs.committed_size(), |
140 "right address out of range"); | 140 "right address out of range"); |
141 assert(left < right, "Heap addresses out of order"); | 141 assert(left < right, "Heap addresses out of order"); |
142 size_t num_cards = pointer_delta(right, left) >> LogN_words; | 142 size_t num_cards = pointer_delta(right, left) >> LogN_words; |
143 memset(&_offset_array[index_for(left)], offset, num_cards); | 143 |
144 // Below, we may use an explicit loop instead of memset() | |
145 // because on certain platforms memset() can give concurrent | |
146 // readers "out-of-thin-air," phantom zeros; see 6948537. | |
147 if (UseMemSetInBOT) { | |
148 memset(&_offset_array[index_for(left)], offset, num_cards); | |
149 } else { | |
150 size_t i = index_for(left); | |
151 const size_t end = i + num_cards; | |
152 for (; i < end; i++) { | |
153 _offset_array[i] = offset; | |
154 } | |
155 } | |
144 } | 156 } |
145 | 157 |
146 void set_offset_array(size_t left, size_t right, u_char offset) { | 158 void set_offset_array(size_t left, size_t right, u_char offset) { |
147 assert(right < _vs.committed_size(), "right address out of range"); | 159 assert(right < _vs.committed_size(), "right address out of range"); |
148 assert(left <= right, "indexes out of order"); | 160 assert(left <= right, "indexes out of order"); |
149 size_t num_cards = right - left + 1; | 161 size_t num_cards = right - left + 1; |
150 memset(&_offset_array[left], offset, num_cards); | 162 |
163 // Below, we may use an explicit loop instead of memset | |
164 // because on certain platforms memset() can give concurrent | |
165 // readers "out-of-thin-air," phantom zeros; see 6948537. | |
166 if (UseMemSetInBOT) { | |
167 memset(&_offset_array[left], offset, num_cards); | |
168 } else { | |
169 size_t i = left; | |
170 const size_t end = i + num_cards; | |
171 for (; i < end; i++) { | |
172 _offset_array[i] = offset; | |
173 } | |
174 } | |
151 } | 175 } |
152 | 176 |
153 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { | 177 void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { |
154 assert(index < _vs.committed_size(), "index out of range"); | 178 assert(index < _vs.committed_size(), "index out of range"); |
155 assert(high >= low, "addresses out of order"); | 179 assert(high >= low, "addresses out of order"); |