提交 f8515126 编写于 作者: K kamg

Merge

...@@ -180,6 +180,7 @@ class ScanRSClosure : public HeapRegionClosure { ...@@ -180,6 +180,7 @@ class ScanRSClosure : public HeapRegionClosure {
CardTableModRefBS *_ct_bs; CardTableModRefBS *_ct_bs;
int _worker_i; int _worker_i;
bool _try_claimed; bool _try_claimed;
size_t _min_skip_distance, _max_skip_distance;
public: public:
ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) : ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) :
_oc(oc), _oc(oc),
...@@ -191,6 +192,8 @@ public: ...@@ -191,6 +192,8 @@ public:
_g1h = G1CollectedHeap::heap(); _g1h = G1CollectedHeap::heap();
_bot_shared = _g1h->bot_shared(); _bot_shared = _g1h->bot_shared();
_ct_bs = (CardTableModRefBS*) (_g1h->barrier_set()); _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set());
_min_skip_distance = 16;
_max_skip_distance = 2 * _g1h->n_par_threads() * _min_skip_distance;
} }
void set_try_claimed() { _try_claimed = true; } void set_try_claimed() { _try_claimed = true; }
...@@ -245,9 +248,13 @@ public: ...@@ -245,9 +248,13 @@ public:
HeapRegionRemSetIterator* iter = _g1h->rem_set_iterator(_worker_i); HeapRegionRemSetIterator* iter = _g1h->rem_set_iterator(_worker_i);
hrrs->init_iterator(iter); hrrs->init_iterator(iter);
size_t card_index; size_t card_index;
size_t skip_distance = 0, current_card = 0, jump_to_card = 0;
while (iter->has_next(card_index)) { while (iter->has_next(card_index)) {
if (current_card < jump_to_card) {
++current_card;
continue;
}
HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index); HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index);
#if 0 #if 0
gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n",
card_start, card_start + CardTableModRefBS::card_size_in_words); card_start, card_start + CardTableModRefBS::card_size_in_words);
...@@ -257,20 +264,28 @@ public: ...@@ -257,20 +264,28 @@ public:
assert(card_region != NULL, "Yielding cards not in the heap?"); assert(card_region != NULL, "Yielding cards not in the heap?");
_cards++; _cards++;
if (!card_region->in_collection_set()) { // If the card is dirty, then we will scan it during updateRS.
// If the card is dirty, then we will scan it during updateRS. if (!card_region->in_collection_set() && !_ct_bs->is_card_dirty(card_index)) {
if (!_ct_bs->is_card_claimed(card_index) && if (!_ct_bs->is_card_claimed(card_index) && _ct_bs->claim_card(card_index)) {
!_ct_bs->is_card_dirty(card_index)) {
assert(_ct_bs->is_card_clean(card_index) ||
_ct_bs->is_card_claimed(card_index) ||
_ct_bs->is_card_deferred(card_index),
"Card is either clean, claimed or deferred");
if (_ct_bs->claim_card(card_index))
scanCard(card_index, card_region); scanCard(card_index, card_region);
} } else if (_try_claimed) {
if (jump_to_card == 0 || jump_to_card != current_card) {
// We did some useful work in the previous iteration.
// Decrease the distance.
skip_distance = MAX2(skip_distance >> 1, _min_skip_distance);
} else {
// Previous iteration resulted in a claim failure.
// Increase the distance.
skip_distance = MIN2(skip_distance << 1, _max_skip_distance);
}
jump_to_card = current_card + skip_distance;
}
} }
++current_card;
}
if (!_try_claimed) {
hrrs->set_iter_complete();
} }
hrrs->set_iter_complete();
return false; return false;
} }
// Set all cards back to clean. // Set all cards back to clean.
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
develop(intx, G1MarkingVerboseLevel, 0, \ develop(intx, G1MarkingVerboseLevel, 0, \
"Level (0-4) of verboseness of the marking code") \ "Level (0-4) of verboseness of the marking code") \
\ \
develop(bool, G1VerifyConcMarkPrintReachable, true, \ develop(bool, G1VerifyConcMarkPrintReachable, false, \
"If conc mark verification fails, print reachable objects") \ "If conc mark verification fails, print reachable objects") \
\ \
develop(bool, G1TraceMarkStackOverflow, false, \ develop(bool, G1TraceMarkStackOverflow, false, \
......
...@@ -718,7 +718,7 @@ void HeapRegion::verify(bool allow_dirty) const { ...@@ -718,7 +718,7 @@ void HeapRegion::verify(bool allow_dirty) const {
vl_cl.failures()) { vl_cl.failures()) {
g1->concurrent_mark()->print_prev_bitmap_reachable(); g1->concurrent_mark()->print_prev_bitmap_reachable();
} }
guarantee(!vl_cl.failures(), "should not have had any failures"); guarantee(!vl_cl.failures(), "region verification failed");
guarantee(p == top(), "end of last object must match end of space"); guarantee(p == top(), "end of last object must match end of space");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册