< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Print this page

        

*** 205,215 **** // wraparound of _hwm. if (_hwm >= _chunk_capacity) { return NULL; } ! size_t cur_idx = Atomic::add(1u, &_hwm) - 1; if (cur_idx >= _chunk_capacity) { return NULL; } TaskQueueEntryChunk* result = ::new (&_base[cur_idx]) TaskQueueEntryChunk; --- 205,215 ---- // wraparound of _hwm. if (_hwm >= _chunk_capacity) { return NULL; } ! size_t cur_idx = Atomic::add(&_hwm, 1u) - 1; if (cur_idx >= _chunk_capacity) { return NULL; } TaskQueueEntryChunk* result = ::new (&_base[cur_idx]) TaskQueueEntryChunk;
*** 278,288 **** _num_root_regions = 0; } void G1CMRootMemRegions::add(HeapWord* start, HeapWord* end) { assert_at_safepoint(); ! size_t idx = Atomic::add((size_t)1, &_num_root_regions) - 1; assert(idx < _max_regions, "Trying to add more root MemRegions than there is space " SIZE_FORMAT, _max_regions); assert(start != NULL && end != NULL && start <= end, "Start (" PTR_FORMAT ") should be less or equal to " "end (" PTR_FORMAT ")", p2i(start), p2i(end)); _root_regions[idx].set_start(start); _root_regions[idx].set_end(end); --- 278,288 ---- _num_root_regions = 0; } void G1CMRootMemRegions::add(HeapWord* start, HeapWord* end) { assert_at_safepoint(); ! size_t idx = Atomic::add(&_num_root_regions, (size_t)1) - 1; assert(idx < _max_regions, "Trying to add more root MemRegions than there is space " SIZE_FORMAT, _max_regions); assert(start != NULL && end != NULL && start <= end, "Start (" PTR_FORMAT ") should be less or equal to " "end (" PTR_FORMAT ")", p2i(start), p2i(end)); _root_regions[idx].set_start(start); _root_regions[idx].set_end(end);
*** 306,316 **** if (_claimed_root_regions >= _num_root_regions) { return NULL; } ! size_t claimed_index = Atomic::add((size_t)1, &_claimed_root_regions) - 1; if (claimed_index < _num_root_regions) { return &_root_regions[claimed_index]; } return NULL; } --- 306,316 ---- if (_claimed_root_regions >= _num_root_regions) { return NULL; } ! size_t claimed_index = Atomic::add(&_claimed_root_regions, (size_t)1) - 1; if (claimed_index < _num_root_regions) { return &_root_regions[claimed_index]; } return NULL; }
*** 1119,1129 **** _g1h(g1h), _cm(cm), _hrclaimer(num_workers), _total_selected_for_rebuild(0), _cl("Post-Marking") { } virtual void work(uint worker_id) { G1UpdateRemSetTrackingBeforeRebuild update_cl(_g1h, _cm, &_cl); _g1h->heap_region_par_iterate_from_worker_offset(&update_cl, &_hrclaimer, worker_id); ! Atomic::add(update_cl.num_selected_for_rebuild(), &_total_selected_for_rebuild); } uint total_selected_for_rebuild() const { return _total_selected_for_rebuild; } // Number of regions for which roughly one thread should be spawned for this work. --- 1119,1129 ---- _g1h(g1h), _cm(cm), _hrclaimer(num_workers), _total_selected_for_rebuild(0), _cl("Post-Marking") { } virtual void work(uint worker_id) { G1UpdateRemSetTrackingBeforeRebuild update_cl(_g1h, _cm, &_cl); _g1h->heap_region_par_iterate_from_worker_offset(&update_cl, &_hrclaimer, worker_id); ! Atomic::add(&_total_selected_for_rebuild, update_cl.num_selected_for_rebuild()); } uint total_selected_for_rebuild() const { return _total_selected_for_rebuild; } // Number of regions for which roughly one thread should be spawned for this work.
*** 1904,1914 **** // Above heap_region_containing may return NULL as we always scan claim // until the end of the heap. In this case, just jump to the next region. HeapWord* end = curr_region != NULL ? curr_region->end() : finger + HeapRegion::GrainWords; // Is the gap between reading the finger and doing the CAS too long? ! HeapWord* res = Atomic::cmpxchg(end, &_finger, finger); if (res == finger && curr_region != NULL) { // we succeeded HeapWord* bottom = curr_region->bottom(); HeapWord* limit = curr_region->next_top_at_mark_start(); --- 1904,1914 ---- // Above heap_region_containing may return NULL as we always scan claim // until the end of the heap. In this case, just jump to the next region. HeapWord* end = curr_region != NULL ? curr_region->end() : finger + HeapRegion::GrainWords; // Is the gap between reading the finger and doing the CAS too long? ! HeapWord* res = Atomic::cmpxchg(&_finger, finger, end); if (res == finger && curr_region != NULL) { // we succeeded HeapWord* bottom = curr_region->bottom(); HeapWord* limit = curr_region->next_top_at_mark_start();
< prev index next >