< prev index next >

src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp

Print this page
rev 8069 : imported patch g1_cleanup


 189       jt->dirty_card_queue().enqueue(byte);
 190     } else {
 191       MutexLockerEx x(Shared_DirtyCardQ_lock,
 192                       Mutex::_no_safepoint_check_flag);
 193       _dcqs.shared_dirty_card_queue()->enqueue(byte);
 194     }
 195   }
 196 }
 197 
 198 void
 199 G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
 200                                                        oop new_val) {
 201   uintptr_t field_uint = (uintptr_t)field;
 202   uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val);
 203   uintptr_t comb = field_uint ^ new_val_uint;
 204   comb = comb >> HeapRegion::LogOfHRGrainBytes;
 205   if (comb == 0) return;
 206   if (new_val == NULL) return;
 207   // Otherwise, log it.
 208   G1SATBCardTableLoggingModRefBS* g1_bs =
 209     barrier_set_cast<G1SATBCardTableLoggingModRefBS>(Universe::heap()->barrier_set());
 210   g1_bs->write_ref_field_work(field, new_val);
 211 }
 212 
 213 void
 214 G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr, bool whole_heap) {
 215   volatile jbyte* byte = byte_for(mr.start());
 216   jbyte* last_byte = byte_for(mr.last());
 217   Thread* thr = Thread::current();
 218   if (whole_heap) {
 219     while (byte <= last_byte) {
 220       *byte = dirty_card;
 221       byte++;
 222     }
 223   } else {
 224     // skip all consecutive young cards
 225     for (; byte <= last_byte && *byte == g1_young_gen; byte++);
 226 
 227     if (byte <= last_byte) {
 228       OrderAccess::storeload();
 229       // Enqueue if necessary.




 189       jt->dirty_card_queue().enqueue(byte);
 190     } else {
 191       MutexLockerEx x(Shared_DirtyCardQ_lock,
 192                       Mutex::_no_safepoint_check_flag);
 193       _dcqs.shared_dirty_card_queue()->enqueue(byte);
 194     }
 195   }
 196 }
 197 
 198 void
 199 G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field,
 200                                                        oop new_val) {
 201   uintptr_t field_uint = (uintptr_t)field;
 202   uintptr_t new_val_uint = cast_from_oop<uintptr_t>(new_val);
 203   uintptr_t comb = field_uint ^ new_val_uint;
 204   comb = comb >> HeapRegion::LogOfHRGrainBytes;
 205   if (comb == 0) return;
 206   if (new_val == NULL) return;
 207   // Otherwise, log it.
 208   G1SATBCardTableLoggingModRefBS* g1_bs =
 209     barrier_set_cast<G1SATBCardTableLoggingModRefBS>(G1CollectedHeap::heap()->barrier_set());
 210   g1_bs->write_ref_field_work(field, new_val);
 211 }
 212 
 213 void
 214 G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr, bool whole_heap) {
 215   volatile jbyte* byte = byte_for(mr.start());
 216   jbyte* last_byte = byte_for(mr.last());
 217   Thread* thr = Thread::current();
 218   if (whole_heap) {
 219     while (byte <= last_byte) {
 220       *byte = dirty_card;
 221       byte++;
 222     }
 223   } else {
 224     // skip all consecutive young cards
 225     for (; byte <= last_byte && *byte == g1_young_gen; byte++);
 226 
 227     if (byte <= last_byte) {
 228       OrderAccess::storeload();
 229       // Enqueue if necessary.


< prev index next >