equal
deleted
inserted
replaced
137 "We shouldn't be looking at clean cards, and this should " |
137 "We shouldn't be looking at clean cards, and this should " |
138 "be the only place they get cleaned."); |
138 "be the only place they get cleaned."); |
139 if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val) |
139 if (CardTableRS::card_is_dirty_wrt_gen_iter(entry_val) |
140 || _ct->is_prev_youngergen_card_val(entry_val)) { |
140 || _ct->is_prev_youngergen_card_val(entry_val)) { |
141 CardValue res = |
141 CardValue res = |
142 Atomic::cmpxchg(CardTableRS::clean_card_val(), entry, entry_val); |
142 Atomic::cmpxchg(entry, entry_val, CardTableRS::clean_card_val()); |
143 if (res == entry_val) { |
143 if (res == entry_val) { |
144 break; |
144 break; |
145 } else { |
145 } else { |
146 assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card, |
146 assert(res == CardTableRS::cur_youngergen_and_prev_nonclean_card, |
147 "The CAS above should only fail if another thread did " |
147 "The CAS above should only fail if another thread did " |
262 } else if (card_is_dirty_wrt_gen_iter(entry_val) |
262 } else if (card_is_dirty_wrt_gen_iter(entry_val) |
263 || is_prev_youngergen_card_val(entry_val)) { |
263 || is_prev_youngergen_card_val(entry_val)) { |
264 // Mark it as both cur and prev youngergen; card cleaning thread will |
264 // Mark it as both cur and prev youngergen; card cleaning thread will |
265 // eventually remove the previous stuff. |
265 // eventually remove the previous stuff. |
266 CardValue new_val = cur_youngergen_and_prev_nonclean_card; |
266 CardValue new_val = cur_youngergen_and_prev_nonclean_card; |
267 CardValue res = Atomic::cmpxchg(new_val, entry, entry_val); |
267 CardValue res = Atomic::cmpxchg(entry, entry_val, new_val); |
268 // Did the CAS succeed? |
268 // Did the CAS succeed? |
269 if (res == entry_val) return; |
269 if (res == entry_val) return; |
270 // Otherwise, retry, to see the new value. |
270 // Otherwise, retry, to see the new value. |
271 continue; |
271 continue; |
272 } else { |
272 } else { |