< prev index next >
src/share/vm/gc/g1/heapRegion.cpp
Print this page
rev 8802 : G1 performance improvements: card batching, joining, sorting, prefetching and write barrier fence elision and simplification based on a global syncrhonization using handshakes piggybacking on thread-local safepoints.
@@ -359,16 +359,14 @@
cur += block_size(cur);
}
return NULL;
}
-HeapWord*
-HeapRegion::
-oops_on_card_seq_iterate_careful(MemRegion mr,
- FilterOutOfRegionClosure* cl,
+
+bool HeapRegion::clean_card(MemRegion& mr,
bool filter_young,
- jbyte* card_ptr) {
+ jbyte* &card_ptr) {
// Currently, we should only have to clean the card if filter_young
// is true and vice versa.
if (filter_young) {
assert(card_ptr != NULL, "pre-condition");
} else {
@@ -382,41 +380,49 @@
if (g1h->is_gc_active()) {
mr = mr.intersection(MemRegion(bottom(), scan_top()));
} else {
mr = mr.intersection(used_region());
}
- if (mr.is_empty()) return NULL;
+ if (mr.is_empty()) return false;
// Otherwise, find the obj that extends onto mr.start().
// The intersection of the incoming mr (for the card) and the
// allocated part of the region is non-empty. This implies that
// we have actually allocated into this region. The code in
// G1CollectedHeap.cpp that allocates a new region sets the
// is_young tag on the region before allocating. Thus we
// safely know if this region is young.
if (is_young() && filter_young) {
- return NULL;
+ return false;
}
assert(!is_young(), "check value of filter_young");
// We can only clean the card here, after we make the decision that
// the card is not young. And we only clean the card if we have been
// asked to (i.e., card_ptr != NULL).
if (card_ptr != NULL) {
*card_ptr = CardTableModRefBS::clean_card_val();
- // We must complete this write before we do any of the reads below.
- OrderAccess::storeload();
}
+ return true;
+}
+
+HeapWord* HeapRegion::process_oops_on_card(MemRegion mr,
+ FilterOutOfRegionClosure *cl,
+ jbyte *card_ptr) {
+ G1CollectedHeap* g1h = G1CollectedHeap::heap();
+ G1SATBCardTableLoggingModRefBS* bs = g1h->g1_barrier_set();
// Cache the boundaries of the memory region in some const locals
HeapWord* const start = mr.start();
HeapWord* const end = mr.end();
+ HeapWord* cur;
+
// We used to use "block_start_careful" here. But we're actually happy
// to update the BOT while we do this...
- HeapWord* cur = block_start(start);
+ cur = block_start(start);
assert(cur <= start, "Postcondition");
oop obj;
HeapWord* next = cur;
@@ -462,10 +468,21 @@
} while (cur < end);
return NULL;
}
+HeapWord*
+HeapRegion::
+oops_on_card_seq_iterate_careful(MemRegion mr,
+ FilterOutOfRegionClosure* cl,
+ bool filter_young,
+ jbyte* card_ptr) {
+ if (!clean_card(mr, filter_young, card_ptr)) return NULL;
+ if (card_ptr != NULL) OrderAccess::storeload(); // serialize card cleaning
+ return process_oops_on_card(mr, cl, card_ptr);
+}
+
// Code roots support
void HeapRegion::add_strong_code_root(nmethod* nm) {
HeapRegionRemSet* hrrs = rem_set();
hrrs->add_strong_code_root(nm);
@@ -1027,6 +1044,5 @@
_top = bottom();
_scan_top = bottom();
set_saved_mark_word(NULL);
reset_bot();
}
-
< prev index next >