--- old/src/share/vm/gc/g1/heapRegion.cpp 2015-08-12 14:09:30.000000000 +0200 +++ new/src/share/vm/gc/g1/heapRegion.cpp 2015-08-12 14:09:30.000000000 +0200 @@ -361,12 +361,10 @@ return NULL; } -HeapWord* -HeapRegion:: -oops_on_card_seq_iterate_careful(MemRegion mr, - FilterOutOfRegionClosure* cl, - bool filter_young, - jbyte* card_ptr) { + +bool HeapRegion::clean_card(MemRegion& mr, + 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) { @@ -384,7 +382,7 @@ } 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 @@ -394,7 +392,7 @@ // 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"); @@ -404,17 +402,25 @@ // 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; @@ -464,6 +470,17 @@ 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) { @@ -1029,4 +1046,3 @@ set_saved_mark_word(NULL); reset_bot(); } -