src/hotspot/share/gc/g1/g1RemSet.cpp
changeset 59252 623722a6aeb9
parent 59249 29b0d0b61615
child 59290 97d13893ec3c
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
   175     void add_dirty_region(uint region) {
   175     void add_dirty_region(uint region) {
   176       if (_contains[region]) {
   176       if (_contains[region]) {
   177         return;
   177         return;
   178       }
   178       }
   179 
   179 
   180       bool marked_as_dirty = Atomic::cmpxchg(true, &_contains[region], false) == false;
   180       bool marked_as_dirty = Atomic::cmpxchg(&_contains[region], false, true) == false;
   181       if (marked_as_dirty) {
   181       if (marked_as_dirty) {
   182         uint allocated = Atomic::add(&_cur_idx, 1u) - 1;
   182         uint allocated = Atomic::add(&_cur_idx, 1u) - 1;
   183         _buffer[allocated] = region;
   183         _buffer[allocated] = region;
   184       }
   184       }
   185     }
   185     }
   435   inline bool claim_collection_set_region(uint region) {
   435   inline bool claim_collection_set_region(uint region) {
   436     assert(region < _max_regions, "Tried to access invalid region %u", region);
   436     assert(region < _max_regions, "Tried to access invalid region %u", region);
   437     if (_collection_set_iter_state[region]) {
   437     if (_collection_set_iter_state[region]) {
   438       return false;
   438       return false;
   439     }
   439     }
   440     return !Atomic::cmpxchg(true, &_collection_set_iter_state[region], false);
   440     return !Atomic::cmpxchg(&_collection_set_iter_state[region], false, true);
   441   }
   441   }
   442 
   442 
   443   bool has_cards_to_scan(uint region) {
   443   bool has_cards_to_scan(uint region) {
   444     assert(region < _max_regions, "Tried to access invalid region %u", region);
   444     assert(region < _max_regions, "Tried to access invalid region %u", region);
   445     return _card_table_scan_state[region] < HeapRegion::CardsPerRegion;
   445     return _card_table_scan_state[region] < HeapRegion::CardsPerRegion;
  1135     // We schedule flushing the remembered sets of humongous fast reclaim candidates
  1135     // We schedule flushing the remembered sets of humongous fast reclaim candidates
  1136     // onto the card table first to allow the remaining parallelized tasks hide it.
  1136     // onto the card table first to allow the remaining parallelized tasks hide it.
  1137     if (_initial_evacuation &&
  1137     if (_initial_evacuation &&
  1138         p->fast_reclaim_humongous_candidates() > 0 &&
  1138         p->fast_reclaim_humongous_candidates() > 0 &&
  1139         !_fast_reclaim_handled &&
  1139         !_fast_reclaim_handled &&
  1140         !Atomic::cmpxchg(true, &_fast_reclaim_handled, false)) {
  1140         !Atomic::cmpxchg(&_fast_reclaim_handled, false, true)) {
  1141 
  1141 
  1142       G1GCParPhaseTimesTracker x(p, G1GCPhaseTimes::MergeER, worker_id);
  1142       G1GCParPhaseTimesTracker x(p, G1GCPhaseTimes::MergeER, worker_id);
  1143 
  1143 
  1144       G1FlushHumongousCandidateRemSets cl(_scan_state);
  1144       G1FlushHumongousCandidateRemSets cl(_scan_state);
  1145       g1h->heap_region_iterate(&cl);
  1145       g1h->heap_region_iterate(&cl);