src/hotspot/share/gc/g1/g1RemSet.cpp
changeset 59249 29b0d0b61615
parent 59233 bd9dba789919
child 59252 623722a6aeb9
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
   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(true, &_contains[region], false) == false;
   181       if (marked_as_dirty) {
   181       if (marked_as_dirty) {
   182         uint allocated = Atomic::add(1u, &_cur_idx) - 1;
   182         uint allocated = Atomic::add(&_cur_idx, 1u) - 1;
   183         _buffer[allocated] = region;
   183         _buffer[allocated] = region;
   184       }
   184       }
   185     }
   185     }
   186 
   186 
   187     // Creates the union of this and the other G1DirtyRegions.
   187     // Creates the union of this and the other G1DirtyRegions.
   253 
   253 
   254     static uint chunk_size() { return M; }
   254     static uint chunk_size() { return M; }
   255 
   255 
   256     void work(uint worker_id) {
   256     void work(uint worker_id) {
   257       while (_cur_dirty_regions < _regions->size()) {
   257       while (_cur_dirty_regions < _regions->size()) {
   258         uint next = Atomic::add(_chunk_length, &_cur_dirty_regions) - _chunk_length;
   258         uint next = Atomic::add(&_cur_dirty_regions, _chunk_length) - _chunk_length;
   259         uint max = MIN2(next + _chunk_length, _regions->size());
   259         uint max = MIN2(next + _chunk_length, _regions->size());
   260 
   260 
   261         for (uint i = next; i < max; i++) {
   261         for (uint i = next; i < max; i++) {
   262           HeapRegion* r = _g1h->region_at(_regions->at(i));
   262           HeapRegion* r = _g1h->region_at(_regions->at(i));
   263           if (!r->is_survivor()) {
   263           if (!r->is_survivor()) {
   445     return _card_table_scan_state[region] < HeapRegion::CardsPerRegion;
   445     return _card_table_scan_state[region] < HeapRegion::CardsPerRegion;
   446   }
   446   }
   447 
   447 
   448   uint claim_cards_to_scan(uint region, uint increment) {
   448   uint claim_cards_to_scan(uint region, uint increment) {
   449     assert(region < _max_regions, "Tried to access invalid region %u", region);
   449     assert(region < _max_regions, "Tried to access invalid region %u", region);
   450     return Atomic::add(increment, &_card_table_scan_state[region]) - increment;
   450     return Atomic::add(&_card_table_scan_state[region], increment) - increment;
   451   }
   451   }
   452 
   452 
   453   void add_dirty_region(uint const region) {
   453   void add_dirty_region(uint const region) {
   454 #ifdef ASSERT
   454 #ifdef ASSERT
   455    HeapRegion* hr = G1CollectedHeap::heap()->region_at(region);
   455    HeapRegion* hr = G1CollectedHeap::heap()->region_at(region);