250 // prev-younger-gen ==> cur_youngergen_and_prev_nonclean_card |
250 // prev-younger-gen ==> cur_youngergen_and_prev_nonclean_card |
251 // cur-younger-gen ==> cur_younger_gen |
251 // cur-younger-gen ==> cur_younger_gen |
252 // cur_youngergen_and_prev_nonclean_card ==> no change. |
252 // cur_youngergen_and_prev_nonclean_card ==> no change. |
253 void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) { |
253 void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) { |
254 jbyte* entry = ct_bs()->byte_for(field); |
254 jbyte* entry = ct_bs()->byte_for(field); |
|
255 #ifdef MIPS64 |
|
256 if (Use3A2000) OrderAccess::fence(); |
|
257 #endif |
255 do { |
258 do { |
256 jbyte entry_val = *entry; |
259 jbyte entry_val = *entry; |
257 // We put this first because it's probably the most common case. |
260 // We put this first because it's probably the most common case. |
258 if (entry_val == clean_card_val()) { |
261 if (entry_val == clean_card_val()) { |
259 // No threat of contention with cleaning threads. |
262 // No threat of contention with cleaning threads. |
264 // Mark it as both cur and prev youngergen; card cleaning thread will |
267 // Mark it as both cur and prev youngergen; card cleaning thread will |
265 // eventually remove the previous stuff. |
268 // eventually remove the previous stuff. |
266 jbyte new_val = cur_youngergen_and_prev_nonclean_card; |
269 jbyte new_val = cur_youngergen_and_prev_nonclean_card; |
267 jbyte res = Atomic::cmpxchg(new_val, entry, entry_val); |
270 jbyte res = Atomic::cmpxchg(new_val, entry, entry_val); |
268 // Did the CAS succeed? |
271 // Did the CAS succeed? |
269 if (res == entry_val) return; |
272 if (res == entry_val) { |
|
273 #ifdef MIPS64 |
|
274 if (Use3A2000) OrderAccess::fence(); |
|
275 #endif |
|
276 return; |
|
277 } |
270 // Otherwise, retry, to see the new value. |
278 // Otherwise, retry, to see the new value. |
271 continue; |
279 continue; |
272 } else { |
280 } else { |
273 assert(entry_val == cur_youngergen_and_prev_nonclean_card |
281 assert(entry_val == cur_youngergen_and_prev_nonclean_card |
274 || entry_val == cur_youngergen_card_val(), |
282 || entry_val == cur_youngergen_card_val(), |