< prev index next >
src/share/vm/gc/g1/heapRegion.cpp
Print this page
rev 12056 : [mq]: simplify
*** 350,412 ****
"marked: " SIZE_FORMAT " used: " SIZE_FORMAT, marked_bytes, used());
_prev_top_at_mark_start = top();
_prev_marked_bytes = marked_bytes;
}
! HeapWord*
! HeapRegion::
! oops_on_card_seq_iterate_careful(MemRegion mr,
FilterOutOfRegionClosure* cl,
- bool filter_young,
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 {
- assert(card_ptr == NULL, "pre-condition");
- }
G1CollectedHeap* g1h = G1CollectedHeap::heap();
// If we're within a stop-world GC, then we might look at a card in a
// GC alloc region that extends onto a GC LAB, which may not be
// parseable. Stop such at the "scan_top" of the region.
if (g1h->is_gc_active()) {
mr = mr.intersection(MemRegion(bottom(), scan_top()));
} else {
mr = mr.intersection(used_region());
}
! if (mr.is_empty()) return NULL;
// 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;
}
- 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();
- }
// Cache the boundaries of the memory region in some const locals
HeapWord* const start = mr.start();
HeapWord* const end = mr.end();
! // 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);
assert(cur <= start, "Postcondition");
oop obj;
--- 350,397 ----
"marked: " SIZE_FORMAT " used: " SIZE_FORMAT, marked_bytes, used());
_prev_top_at_mark_start = top();
_prev_marked_bytes = marked_bytes;
}
! bool HeapRegion::oops_on_card_seq_iterate_careful(MemRegion mr,
FilterOutOfRegionClosure* cl,
jbyte* card_ptr) {
assert(card_ptr != NULL, "pre-condition");
G1CollectedHeap* g1h = G1CollectedHeap::heap();
// If we're within a stop-world GC, then we might look at a card in a
// GC alloc region that extends onto a GC LAB, which may not be
// parseable. Stop such at the "scan_top" of the region.
if (g1h->is_gc_active()) {
mr = mr.intersection(MemRegion(bottom(), scan_top()));
} else {
mr = mr.intersection(used_region());
}
! if (mr.is_empty()) return true;
// 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()) {
! return true;
}
// We can only clean the card here, after we make the decision that
! // the card is not young.
*card_ptr = CardTableModRefBS::clean_card_val();
// We must complete this write before we do any of the reads below.
OrderAccess::storeload();
// Cache the boundaries of the memory region in some const locals
HeapWord* const start = mr.start();
HeapWord* const end = mr.end();
! // Update BOT as needed while finding start of (potential) object.
HeapWord* cur = block_start(start);
assert(cur <= start, "Postcondition");
oop obj;
*** 414,424 ****
do {
cur = next;
obj = oop(cur);
if (obj->klass_or_null() == NULL) {
// Ran into an unparseable point.
! return cur;
}
// Otherwise...
next = cur + block_size(cur);
} while (next <= start);
--- 399,411 ----
do {
cur = next;
obj = oop(cur);
if (obj->klass_or_null() == NULL) {
// Ran into an unparseable point.
! assert(!g1h->is_gc_active(),
! "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
! return false;
}
// Otherwise...
next = cur + block_size(cur);
} while (next <= start);
*** 431,441 ****
do {
obj = oop(cur);
assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant");
if (obj->klass_or_null() == NULL) {
// Ran into an unparseable point.
! return cur;
}
// Advance the current pointer. "obj" still points to the object to iterate.
cur = cur + block_size(cur);
--- 418,430 ----
do {
obj = oop(cur);
assert((cur + block_size(cur)) > (HeapWord*)obj, "Loop invariant");
if (obj->klass_or_null() == NULL) {
// Ran into an unparseable point.
! assert(!g1h->is_gc_active(),
! "Unparsable heap during GC at " PTR_FORMAT, p2i(cur));
! return false;
}
// Advance the current pointer. "obj" still points to the object to iterate.
cur = cur + block_size(cur);
*** 450,460 ****
obj->oop_iterate(cl, mr);
}
}
} while (cur < end);
! return NULL;
}
// Code roots support
void HeapRegion::add_strong_code_root(nmethod* nm) {
--- 439,449 ----
obj->oop_iterate(cl, mr);
}
}
} while (cur < end);
! return true;
}
// Code roots support
void HeapRegion::add_strong_code_root(nmethod* nm) {
< prev index next >