src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp
Print this page
rev 6923 : imported patch 8054819-rename-heapregionseq
*** 25,35 ****
#include "precompiled.hpp"
#include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
! #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
#include "memory/allocation.hpp"
#include "memory/padded.inline.hpp"
#include "memory/space.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
--- 25,35 ----
#include "precompiled.hpp"
#include "gc_implementation/g1/concurrentG1Refine.hpp"
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/heapRegionRemSet.hpp"
! #include "gc_implementation/g1/heapRegionManager.inline.hpp"
#include "memory/allocation.hpp"
#include "memory/padded.inline.hpp"
#include "memory/space.inline.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
*** 418,428 ****
void OtherRegionsTable::print_from_card_cache() {
FromCardCache::print();
}
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
! uint cur_hrs_ind = hr()->hrs_index();
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
from,
UseCompressedOops
--- 418,428 ----
void OtherRegionsTable::print_from_card_cache() {
FromCardCache::print();
}
void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, int tid) {
! uint cur_hrm_ind = hr()->hrm_index();
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").",
from,
UseCompressedOops
*** 433,456 ****
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
hr()->bottom(), from_card,
! FromCardCache::at((uint)tid, cur_hrs_ind));
}
! if (FromCardCache::contains_or_replace((uint)tid, cur_hrs_ind, from_card)) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" from-card cache hit.");
}
assert(contains_reference(from), "We just added it!");
return;
}
// Note that this may be a continued H region.
HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
! RegionIdx_t from_hrs_ind = (RegionIdx_t) from_hr->hrs_index();
// If the region is already coarsened, return.
if (_coarse_map.at(from_hrs_ind)) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" coarse map hit.");
--- 433,456 ----
int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift);
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)",
hr()->bottom(), from_card,
! FromCardCache::at((uint)tid, cur_hrm_ind));
}
! if (FromCardCache::contains_or_replace((uint)tid, cur_hrm_ind, from_card)) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" from-card cache hit.");
}
assert(contains_reference(from), "We just added it!");
return;
}
// Note that this may be a continued H region.
HeapRegion* from_hr = _g1h->heap_region_containing_raw(from);
! RegionIdx_t from_hrs_ind = (RegionIdx_t) from_hr->hrm_index();
// If the region is already coarsened, return.
if (_coarse_map.at(from_hrs_ind)) {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" coarse map hit.");
*** 493,503 ****
return;
} else {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" [tid %d] sparse table entry "
"overflow(f: %d, t: %u)",
! tid, from_hrs_ind, cur_hrs_ind);
}
}
if (_n_fine_entries == _max_fine_entries) {
prt = delete_region_table();
--- 493,503 ----
return;
} else {
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print_cr(" [tid %d] sparse table entry "
"overflow(f: %d, t: %u)",
! tid, from_hrs_ind, cur_hrm_ind);
}
}
if (_n_fine_entries == _max_fine_entries) {
prt = delete_region_table();
*** 605,617 ****
}
guarantee(max != NULL, "Since _n_fine_entries > 0");
// Set the corresponding coarse bit.
! size_t max_hrs_index = (size_t) max->hr()->hrs_index();
! if (!_coarse_map.at(max_hrs_index)) {
! _coarse_map.at_put(max_hrs_index, true);
_n_coarse_entries++;
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
"for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
hr()->bottom(),
--- 605,617 ----
}
guarantee(max != NULL, "Since _n_fine_entries > 0");
// Set the corresponding coarse bit.
! size_t max_hrm_index = (size_t) max->hr()->hrm_index();
! if (!_coarse_map.at(max_hrm_index)) {
! _coarse_map.at_put(max_hrm_index, true);
_n_coarse_entries++;
if (G1TraceHeapRegionRememberedSet) {
gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
"for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
hr()->bottom(),
*** 631,641 ****
// At present, this must be called stop-world single-threaded.
void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
BitMap* region_bm, BitMap* card_bm) {
// First eliminated garbage regions from the coarse map.
if (G1RSScrubVerbose) {
! gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrs_index());
}
assert(_coarse_map.size() == region_bm->size(), "Precondition");
if (G1RSScrubVerbose) {
gclog_or_tty->print(" Coarse map: before = "SIZE_FORMAT"...",
--- 631,641 ----
// At present, this must be called stop-world single-threaded.
void OtherRegionsTable::scrub(CardTableModRefBS* ctbs,
BitMap* region_bm, BitMap* card_bm) {
// First eliminated garbage regions from the coarse map.
if (G1RSScrubVerbose) {
! gclog_or_tty->print_cr("Scrubbing region %u:", hr()->hrm_index());
}
assert(_coarse_map.size() == region_bm->size(), "Precondition");
if (G1RSScrubVerbose) {
gclog_or_tty->print(" Coarse map: before = "SIZE_FORMAT"...",
*** 654,666 ****
while (cur != NULL) {
PerRegionTable* nxt = cur->collision_list_next();
// If the entire region is dead, eliminate.
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr(" For other region %u:",
! cur->hr()->hrs_index());
}
! if (!region_bm->at((size_t) cur->hr()->hrs_index())) {
*prev = nxt;
cur->set_collision_list_next(NULL);
_n_fine_entries--;
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr(" deleted via region map.");
--- 654,666 ----
while (cur != NULL) {
PerRegionTable* nxt = cur->collision_list_next();
// If the entire region is dead, eliminate.
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr(" For other region %u:",
! cur->hr()->hrm_index());
}
! if (!region_bm->at((size_t) cur->hr()->hrm_index())) {
*prev = nxt;
cur->set_collision_list_next(NULL);
_n_fine_entries--;
if (G1RSScrubVerbose) {
gclog_or_tty->print_cr(" deleted via region map.");
*** 750,760 ****
size_t OtherRegionsTable::fl_mem_size() {
return PerRegionTable::fl_mem_size();
}
void OtherRegionsTable::clear_fcc() {
! FromCardCache::clear(hr()->hrs_index());
}
void OtherRegionsTable::clear() {
// if there are no entries, skip this step
if (_first_all_fine_prts != NULL) {
--- 750,760 ----
size_t OtherRegionsTable::fl_mem_size() {
return PerRegionTable::fl_mem_size();
}
void OtherRegionsTable::clear_fcc() {
! FromCardCache::clear(hr()->hrm_index());
}
void OtherRegionsTable::clear() {
// if there are no entries, skip this step
if (_first_all_fine_prts != NULL) {
*** 801,811 ****
return contains_reference_locked(from);
}
bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const {
HeapRegion* hr = _g1h->heap_region_containing_raw(from);
! RegionIdx_t hr_ind = (RegionIdx_t) hr->hrs_index();
// Is this region in the coarse map?
if (_coarse_map.at(hr_ind)) return true;
PerRegionTable* prt = find_region_table(hr_ind & _mod_max_fine_entries_mask,
hr);
--- 801,811 ----
return contains_reference_locked(from);
}
bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const {
HeapRegion* hr = _g1h->heap_region_containing_raw(from);
! RegionIdx_t hr_ind = (RegionIdx_t) hr->hrm_index();
// Is this region in the coarse map?
if (_coarse_map.at(hr_ind)) return true;
PerRegionTable* prt = find_region_table(hr_ind & _mod_max_fine_entries_mask,
hr);
*** 838,848 ****
}
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
HeapRegion* hr)
: _bosa(bosa),
! _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrs_index()), true),
_code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) {
reset_for_par_iteration();
}
void HeapRegionRemSet::setup_remset_size() {
--- 838,848 ----
}
HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
HeapRegion* hr)
: _bosa(bosa),
! _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true),
_code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) {
reset_for_par_iteration();
}
void HeapRegionRemSet::setup_remset_size() {