src/share/vm/gc_implementation/g1/g1RemSet.cpp

Fri, 17 May 2013 11:57:05 +0200

author
ehelin
date
Fri, 17 May 2013 11:57:05 +0200
changeset 5159
001ec9515f84
parent 5078
194f52aa2f23
child 5204
e72f7eecc96d
permissions
-rw-r--r--

8014277: Remove ObjectClosure as base class for BoolObjectClosure
Reviewed-by: brutisso, tschatzl

ysr@777 1 /*
johnc@5078 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
ysr@777 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ysr@777 4 *
ysr@777 5 * This code is free software; you can redistribute it and/or modify it
ysr@777 6 * under the terms of the GNU General Public License version 2 only, as
ysr@777 7 * published by the Free Software Foundation.
ysr@777 8 *
ysr@777 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ysr@777 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ysr@777 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ysr@777 12 * version 2 for more details (a copy is included in the LICENSE file that
ysr@777 13 * accompanied this code).
ysr@777 14 *
ysr@777 15 * You should have received a copy of the GNU General Public License version
ysr@777 16 * 2 along with this work; if not, write to the Free Software Foundation,
ysr@777 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ysr@777 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
ysr@777 22 *
ysr@777 23 */
ysr@777 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "gc_implementation/g1/bufferingOopClosure.hpp"
stefank@2314 27 #include "gc_implementation/g1/concurrentG1Refine.hpp"
stefank@2314 28 #include "gc_implementation/g1/concurrentG1RefineThread.hpp"
stefank@2314 29 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
stefank@2314 30 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
stefank@2314 31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
johnc@5078 32 #include "gc_implementation/g1/g1HotCardCache.hpp"
brutisso@3923 33 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
stefank@2314 34 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
stefank@2314 35 #include "gc_implementation/g1/g1RemSet.inline.hpp"
stefank@2314 36 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
stefank@2314 37 #include "memory/iterator.hpp"
stefank@2314 38 #include "oops/oop.inline.hpp"
stefank@2314 39 #include "utilities/intHisto.hpp"
ysr@777 40
ysr@777 41 #define CARD_REPEAT_HISTO 0
ysr@777 42
ysr@777 43 #if CARD_REPEAT_HISTO
ysr@777 44 static size_t ct_freq_sz;
ysr@777 45 static jbyte* ct_freq = NULL;
ysr@777 46
ysr@777 47 void init_ct_freq_table(size_t heap_sz_bytes) {
ysr@777 48 if (ct_freq == NULL) {
ysr@777 49 ct_freq_sz = heap_sz_bytes/CardTableModRefBS::card_size;
ysr@777 50 ct_freq = new jbyte[ct_freq_sz];
ysr@777 51 for (size_t j = 0; j < ct_freq_sz; j++) ct_freq[j] = 0;
ysr@777 52 }
ysr@777 53 }
ysr@777 54
ysr@777 55 void ct_freq_note_card(size_t index) {
ysr@777 56 assert(0 <= index && index < ct_freq_sz, "Bounds error.");
ysr@777 57 if (ct_freq[index] < 100) { ct_freq[index]++; }
ysr@777 58 }
ysr@777 59
ysr@777 60 static IntHistogram card_repeat_count(10, 10);
ysr@777 61
ysr@777 62 void ct_freq_update_histo_and_reset() {
ysr@777 63 for (size_t j = 0; j < ct_freq_sz; j++) {
ysr@777 64 card_repeat_count.add_entry(ct_freq[j]);
ysr@777 65 ct_freq[j] = 0;
ysr@777 66 }
ysr@777 67
ysr@777 68 }
ysr@777 69 #endif
ysr@777 70
johnc@2216 71 G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs)
johnc@2216 72 : _g1(g1), _conc_refine_cards(0),
johnc@2216 73 _ct_bs(ct_bs), _g1p(_g1->g1_policy()),
ysr@777 74 _cg1r(g1->concurrent_g1_refine()),
johnc@2060 75 _cset_rs_update_cl(NULL),
ysr@777 76 _cards_scanned(NULL), _total_cards_scanned(0)
ysr@777 77 {
ysr@777 78 _seq_task = new SubTasksDone(NumSeqTasks);
iveresov@1051 79 guarantee(n_workers() > 0, "There should be some workers");
zgu@3900 80 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC);
iveresov@1051 81 for (uint i = 0; i < n_workers(); i++) {
johnc@2060 82 _cset_rs_update_cl[i] = NULL;
iveresov@1051 83 }
ysr@777 84 }
ysr@777 85
johnc@2216 86 G1RemSet::~G1RemSet() {
ysr@777 87 delete _seq_task;
iveresov@1051 88 for (uint i = 0; i < n_workers(); i++) {
johnc@2060 89 assert(_cset_rs_update_cl[i] == NULL, "it should be");
iveresov@1051 90 }
zgu@3900 91 FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
ysr@777 92 }
ysr@777 93
ysr@777 94 void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
ysr@777 95 if (_g1->is_in_g1_reserved(mr.start())) {
ysr@777 96 _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size));
ysr@777 97 if (_start_first == NULL) _start_first = mr.start();
ysr@777 98 }
ysr@777 99 }
ysr@777 100
ysr@777 101 class ScanRSClosure : public HeapRegionClosure {
ysr@777 102 size_t _cards_done, _cards;
ysr@777 103 G1CollectedHeap* _g1h;
ysr@777 104 OopsInHeapRegionClosure* _oc;
ysr@777 105 G1BlockOffsetSharedArray* _bot_shared;
ysr@777 106 CardTableModRefBS *_ct_bs;
ysr@777 107 int _worker_i;
iveresov@1696 108 int _block_size;
ysr@777 109 bool _try_claimed;
ysr@777 110 public:
ysr@777 111 ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) :
ysr@777 112 _oc(oc),
ysr@777 113 _cards(0),
ysr@777 114 _cards_done(0),
ysr@777 115 _worker_i(worker_i),
ysr@777 116 _try_claimed(false)
ysr@777 117 {
ysr@777 118 _g1h = G1CollectedHeap::heap();
ysr@777 119 _bot_shared = _g1h->bot_shared();
ysr@777 120 _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set());
iveresov@1696 121 _block_size = MAX2<int>(G1RSetScanBlockSize, 1);
ysr@777 122 }
ysr@777 123
ysr@777 124 void set_try_claimed() { _try_claimed = true; }
ysr@777 125
ysr@777 126 void scanCard(size_t index, HeapRegion *r) {
johnc@3219 127 // Stack allocate the DirtyCardToOopClosure instance
johnc@3219 128 HeapRegionDCTOC cl(_g1h, r, _oc,
johnc@3219 129 CardTableModRefBS::Precise,
johnc@3219 130 HeapRegionDCTOC::IntoCSFilterKind);
ysr@777 131
ysr@777 132 // Set the "from" region in the closure.
ysr@777 133 _oc->set_region(r);
ysr@777 134 HeapWord* card_start = _bot_shared->address_for_index(index);
ysr@777 135 HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words;
ysr@777 136 Space *sp = SharedHeap::heap()->space_containing(card_start);
tonyp@2849 137 MemRegion sm_region = sp->used_region_at_save_marks();
ysr@777 138 MemRegion mr = sm_region.intersection(MemRegion(card_start,card_end));
tonyp@2849 139 if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
tonyp@2849 140 // We make the card as "claimed" lazily (so races are possible
tonyp@2849 141 // but they're benign), which reduces the number of duplicate
tonyp@2849 142 // scans (the rsets of the regions in the cset can intersect).
tonyp@2849 143 _ct_bs->set_card_claimed(index);
tonyp@2849 144 _cards_done++;
johnc@3219 145 cl.do_MemRegion(mr);
ysr@777 146 }
ysr@777 147 }
ysr@777 148
ysr@777 149 void printCard(HeapRegion* card_region, size_t card_index,
ysr@777 150 HeapWord* card_start) {
ysr@777 151 gclog_or_tty->print_cr("T %d Region [" PTR_FORMAT ", " PTR_FORMAT ") "
ysr@777 152 "RS names card %p: "
ysr@777 153 "[" PTR_FORMAT ", " PTR_FORMAT ")",
ysr@777 154 _worker_i,
ysr@777 155 card_region->bottom(), card_region->end(),
ysr@777 156 card_index,
ysr@777 157 card_start, card_start + G1BlockOffsetSharedArray::N_words);
ysr@777 158 }
ysr@777 159
ysr@777 160 bool doHeapRegion(HeapRegion* r) {
ysr@777 161 assert(r->in_collection_set(), "should only be called on elements of CS.");
ysr@777 162 HeapRegionRemSet* hrrs = r->rem_set();
ysr@777 163 if (hrrs->iter_is_complete()) return false; // All done.
ysr@777 164 if (!_try_claimed && !hrrs->claim_iter()) return false;
tonyp@2849 165 // If we ever free the collection set concurrently, we should also
tonyp@2849 166 // clear the card table concurrently therefore we won't need to
tonyp@2849 167 // add regions of the collection set to the dirty cards region.
apetrusenko@1231 168 _g1h->push_dirty_cards_region(r);
ysr@777 169 // If we didn't return above, then
ysr@777 170 // _try_claimed || r->claim_iter()
ysr@777 171 // is true: either we're supposed to work on claimed-but-not-complete
ysr@777 172 // regions, or we successfully claimed the region.
johnc@5014 173 HeapRegionRemSetIterator iter(hrrs);
ysr@777 174 size_t card_index;
iveresov@1696 175
iveresov@1696 176 // We claim cards in block so as to recude the contention. The block size is determined by
iveresov@1696 177 // the G1RSetScanBlockSize parameter.
iveresov@1696 178 size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
johnc@5014 179 for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
iveresov@1696 180 if (current_card >= jump_to_card + _block_size) {
iveresov@1696 181 jump_to_card = hrrs->iter_claimed_next(_block_size);
iveresov@1182 182 }
iveresov@1696 183 if (current_card < jump_to_card) continue;
ysr@777 184 HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index);
ysr@777 185 #if 0
ysr@777 186 gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n",
ysr@777 187 card_start, card_start + CardTableModRefBS::card_size_in_words);
ysr@777 188 #endif
ysr@777 189
ysr@777 190 HeapRegion* card_region = _g1h->heap_region_containing(card_start);
ysr@777 191 assert(card_region != NULL, "Yielding cards not in the heap?");
ysr@777 192 _cards++;
ysr@777 193
apetrusenko@1231 194 if (!card_region->is_on_dirty_cards_region_list()) {
apetrusenko@1231 195 _g1h->push_dirty_cards_region(card_region);
apetrusenko@1231 196 }
apetrusenko@1231 197
tonyp@2849 198 // If the card is dirty, then we will scan it during updateRS.
tonyp@2849 199 if (!card_region->in_collection_set() &&
tonyp@2849 200 !_ct_bs->is_card_dirty(card_index)) {
tonyp@2849 201 scanCard(card_index, card_region);
ysr@777 202 }
ysr@777 203 }
iveresov@1182 204 if (!_try_claimed) {
iveresov@1182 205 hrrs->set_iter_complete();
iveresov@1182 206 }
ysr@777 207 return false;
ysr@777 208 }
ysr@777 209 size_t cards_done() { return _cards_done;}
ysr@777 210 size_t cards_looked_up() { return _cards;}
ysr@777 211 };
ysr@777 212
johnc@2216 213 void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, int worker_i) {
ysr@777 214 double rs_time_start = os::elapsedTime();
johnc@3296 215 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
ysr@777 216
iveresov@1696 217 ScanRSClosure scanRScl(oc, worker_i);
johnc@3175 218
ysr@777 219 _g1->collection_set_iterate_from(startRegion, &scanRScl);
ysr@777 220 scanRScl.set_try_claimed();
ysr@777 221 _g1->collection_set_iterate_from(startRegion, &scanRScl);
ysr@777 222
iveresov@1696 223 double scan_rs_time_sec = os::elapsedTime() - rs_time_start;
ysr@777 224
ysr@777 225 assert( _cards_scanned != NULL, "invariant" );
ysr@777 226 _cards_scanned[worker_i] = scanRScl.cards_done();
ysr@777 227
brutisso@3923 228 _g1p->phase_times()->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0);
ysr@777 229 }
ysr@777 230
johnc@2060 231 // Closure used for updating RSets and recording references that
johnc@2060 232 // point into the collection set. Only called during an
johnc@2060 233 // evacuation pause.
ysr@777 234
johnc@2060 235 class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure {
johnc@2060 236 G1RemSet* _g1rs;
johnc@2060 237 DirtyCardQueue* _into_cset_dcq;
johnc@2060 238 public:
johnc@2060 239 RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h,
johnc@2060 240 DirtyCardQueue* into_cset_dcq) :
johnc@2060 241 _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq)
johnc@2060 242 {}
johnc@2060 243 bool do_card_ptr(jbyte* card_ptr, int worker_i) {
johnc@2060 244 // The only time we care about recording cards that
johnc@2060 245 // contain references that point into the collection set
johnc@2060 246 // is during RSet updating within an evacuation pause.
johnc@2060 247 // In this case worker_i should be the id of a GC worker thread.
johnc@2060 248 assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
brutisso@2646 249 assert(worker_i < (int) (ParallelGCThreads == 0 ? 1 : ParallelGCThreads), "should be a GC worker");
johnc@2060 250
johnc@5078 251 if (_g1rs->refine_card(card_ptr, worker_i, true)) {
johnc@2060 252 // 'card_ptr' contains references that point into the collection
johnc@2060 253 // set. We need to record the card in the DCQS
johnc@2060 254 // (G1CollectedHeap::into_cset_dirty_card_queue_set())
johnc@2060 255 // that's used for that purpose.
johnc@2060 256 //
johnc@2060 257 // Enqueue the card
johnc@2060 258 _into_cset_dcq->enqueue(card_ptr);
johnc@2060 259 }
johnc@2060 260 return true;
johnc@2060 261 }
johnc@2060 262 };
johnc@2060 263
johnc@2216 264 void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, int worker_i) {
ysr@777 265 double start = os::elapsedTime();
johnc@2060 266 // Apply the given closure to all remaining log entries.
johnc@2060 267 RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq);
johnc@3175 268
johnc@2060 269 _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i);
johnc@2060 270
iveresov@1229 271 // Now there should be no dirty cards.
iveresov@1229 272 if (G1RSLogCheckCardTable) {
iveresov@1229 273 CountNonCleanMemRegionClosure cl(_g1);
iveresov@1229 274 _ct_bs->mod_card_iterate(&cl);
iveresov@1229 275 // XXX This isn't true any more: keeping cards of young regions
iveresov@1229 276 // marked dirty broke it. Need some reasonable fix.
iveresov@1229 277 guarantee(cl.n() == 0, "Card table should be clean.");
ysr@777 278 }
iveresov@1229 279
brutisso@3923 280 _g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0);
ysr@777 281 }
ysr@777 282
johnc@2216 283 void G1RemSet::cleanupHRRS() {
ysr@777 284 HeapRegionRemSet::cleanup();
ysr@777 285 }
ysr@777 286
johnc@2216 287 void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc,
ysr@777 288 int worker_i) {
ysr@777 289 #if CARD_REPEAT_HISTO
ysr@777 290 ct_freq_update_histo_and_reset();
ysr@777 291 #endif
ysr@777 292
johnc@2060 293 // We cache the value of 'oc' closure into the appropriate slot in the
johnc@2060 294 // _cset_rs_update_cl for this worker
johnc@2060 295 assert(worker_i < (int)n_workers(), "sanity");
johnc@2060 296 _cset_rs_update_cl[worker_i] = oc;
johnc@2060 297
johnc@2060 298 // A DirtyCardQueue that is used to hold cards containing references
johnc@2060 299 // that point into the collection set. This DCQ is associated with a
johnc@2060 300 // special DirtyCardQueueSet (see g1CollectedHeap.hpp). Under normal
johnc@2060 301 // circumstances (i.e. the pause successfully completes), these cards
johnc@2060 302 // are just discarded (there's no need to update the RSets of regions
johnc@2060 303 // that were in the collection set - after the pause these regions
johnc@2060 304 // are wholly 'free' of live objects. In the event of an evacuation
johnc@2060 305 // failure the cards/buffers in this queue set are:
johnc@2060 306 // * passed to the DirtyCardQueueSet that is used to manage deferred
johnc@2060 307 // RSet updates, or
johnc@2060 308 // * scanned for references that point into the collection set
johnc@2060 309 // and the RSet of the corresponding region in the collection set
johnc@2060 310 // is updated immediately.
johnc@2060 311 DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
johnc@2060 312
johnc@2063 313 assert((ParallelGCThreads > 0) || worker_i == 0, "invariant");
johnc@2063 314
johnc@2063 315 // The two flags below were introduced temporarily to serialize
johnc@2063 316 // the updating and scanning of remembered sets. There are some
johnc@2063 317 // race conditions when these two operations are done in parallel
johnc@2063 318 // and they are causing failures. When we resolve said race
johnc@2063 319 // conditions, we'll revert back to parallel remembered set
johnc@2063 320 // updating and scanning. See CRs 6677707 and 6677708.
johnc@2063 321 if (G1UseParallelRSetUpdating || (worker_i == 0)) {
johnc@2063 322 updateRS(&into_cset_dcq, worker_i);
ysr@777 323 } else {
brutisso@4015 324 _g1p->phase_times()->record_update_rs_processed_buffers(worker_i, 0);
brutisso@3923 325 _g1p->phase_times()->record_update_rs_time(worker_i, 0.0);
johnc@2063 326 }
johnc@2063 327 if (G1UseParallelRSetScanning || (worker_i == 0)) {
johnc@2063 328 scanRS(oc, worker_i);
johnc@2063 329 } else {
brutisso@3923 330 _g1p->phase_times()->record_scan_rs_time(worker_i, 0.0);
ysr@777 331 }
johnc@2060 332
johnc@2060 333 // We now clear the cached values of _cset_rs_update_cl for this worker
johnc@2060 334 _cset_rs_update_cl[worker_i] = NULL;
ysr@777 335 }
ysr@777 336
johnc@2216 337 void G1RemSet::prepare_for_oops_into_collection_set_do() {
ysr@777 338 cleanupHRRS();
ysr@777 339 ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine();
ysr@777 340 _g1->set_refine_cte_cl_concurrency(false);
ysr@777 341 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
ysr@777 342 dcqs.concatenate_logs();
ysr@777 343
jmasa@3294 344 if (G1CollectedHeap::use_parallel_gc_threads()) {
jmasa@3294 345 // Don't set the number of workers here. It will be set
jmasa@3294 346 // when the task is run
jmasa@3294 347 // _seq_task->set_n_termination((int)n_workers());
ysr@777 348 }
ysr@777 349 guarantee( _cards_scanned == NULL, "invariant" );
zgu@3900 350 _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers(), mtGC);
apetrusenko@980 351 for (uint i = 0; i < n_workers(); ++i) {
apetrusenko@980 352 _cards_scanned[i] = 0;
apetrusenko@980 353 }
ysr@777 354 _total_cards_scanned = 0;
ysr@777 355 }
ysr@777 356
ysr@777 357
johnc@2060 358 // This closure, applied to a DirtyCardQueueSet, is used to immediately
johnc@2060 359 // update the RSets for the regions in the CSet. For each card it iterates
johnc@2060 360 // through the oops which coincide with that card. It scans the reference
johnc@2060 361 // fields in each oop; when it finds an oop that points into the collection
johnc@2060 362 // set, the RSet for the region containing the referenced object is updated.
johnc@2060 363 class UpdateRSetCardTableEntryIntoCSetClosure: public CardTableEntryClosure {
iveresov@1051 364 G1CollectedHeap* _g1;
johnc@2060 365 CardTableModRefBS* _ct_bs;
iveresov@1051 366 public:
johnc@2060 367 UpdateRSetCardTableEntryIntoCSetClosure(G1CollectedHeap* g1,
johnc@2060 368 CardTableModRefBS* bs):
johnc@2060 369 _g1(g1), _ct_bs(bs)
johnc@2060 370 { }
johnc@2060 371
johnc@2060 372 bool do_card_ptr(jbyte* card_ptr, int worker_i) {
johnc@2060 373 // Construct the region representing the card.
johnc@2060 374 HeapWord* start = _ct_bs->addr_for(card_ptr);
johnc@2060 375 // And find the region containing it.
johnc@2060 376 HeapRegion* r = _g1->heap_region_containing(start);
johnc@2060 377 assert(r != NULL, "unexpected null");
johnc@2060 378
johnc@2060 379 // Scan oops in the card looking for references into the collection set
coleenp@4037 380 // Don't use addr_for(card_ptr + 1) which can ask for
coleenp@4037 381 // a card beyond the heap. This is not safe without a perm
coleenp@4037 382 // gen.
coleenp@4037 383 HeapWord* end = start + CardTableModRefBS::card_size_in_words;
johnc@2060 384 MemRegion scanRegion(start, end);
johnc@2060 385
johnc@2060 386 UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set());
johnc@3179 387 FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl);
johnc@2060 388 FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl);
johnc@2060 389
johnc@2060 390 // We can pass false as the "filter_young" parameter here as:
johnc@2060 391 // * we should be in a STW pause,
johnc@2060 392 // * the DCQS to which this closure is applied is used to hold
johnc@2060 393 // references that point into the collection set from the prior
johnc@2060 394 // RSet updating,
johnc@2060 395 // * the post-write barrier shouldn't be logging updates to young
johnc@2060 396 // regions (but there is a situation where this can happen - see
johnc@5078 397 // the comment in G1RemSet::refine_card() below -
johnc@2060 398 // that should not be applicable here), and
johnc@2060 399 // * during actual RSet updating, the filtering of cards in young
johnc@2060 400 // regions in HeapRegion::oops_on_card_seq_iterate_careful is
johnc@2060 401 // employed.
johnc@2060 402 // As a result, when this closure is applied to "refs into cset"
johnc@2060 403 // DCQS, we shouldn't see any cards in young regions.
johnc@2060 404 update_rs_cl.set_region(r);
johnc@2060 405 HeapWord* stop_point =
johnc@2060 406 r->oops_on_card_seq_iterate_careful(scanRegion,
tonyp@2849 407 &filter_then_update_rs_cset_oop_cl,
tonyp@2849 408 false /* filter_young */,
tonyp@2849 409 NULL /* card_ptr */);
johnc@2060 410
johnc@2060 411 // Since this is performed in the event of an evacuation failure, we
johnc@2060 412 // we shouldn't see a non-null stop point
johnc@2060 413 assert(stop_point == NULL, "saw an unallocated region");
johnc@2060 414 return true;
iveresov@1051 415 }
iveresov@1051 416 };
iveresov@1051 417
johnc@2216 418 void G1RemSet::cleanup_after_oops_into_collection_set_do() {
ysr@777 419 guarantee( _cards_scanned != NULL, "invariant" );
ysr@777 420 _total_cards_scanned = 0;
tonyp@2974 421 for (uint i = 0; i < n_workers(); ++i) {
ysr@777 422 _total_cards_scanned += _cards_scanned[i];
tonyp@2974 423 }
zgu@3900 424 FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC);
ysr@777 425 _cards_scanned = NULL;
ysr@777 426 // Cleanup after copy
ysr@777 427 _g1->set_refine_cte_cl_concurrency(true);
ysr@777 428 // Set all cards back to clean.
ysr@777 429 _g1->cleanUpCardTable();
iveresov@1229 430
johnc@2060 431 DirtyCardQueueSet& into_cset_dcqs = _g1->into_cset_dirty_card_queue_set();
johnc@2060 432 int into_cset_n_buffers = into_cset_dcqs.completed_buffers_num();
johnc@2060 433
iveresov@1051 434 if (_g1->evacuation_failed()) {
johnc@2060 435 // Restore remembered sets for the regions pointing into the collection set.
johnc@2060 436
iveresov@1051 437 if (G1DeferredRSUpdate) {
johnc@2060 438 // If deferred RS updates are enabled then we just need to transfer
johnc@2060 439 // the completed buffers from (a) the DirtyCardQueueSet used to hold
johnc@2060 440 // cards that contain references that point into the collection set
johnc@2060 441 // to (b) the DCQS used to hold the deferred RS updates
johnc@2060 442 _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs);
iveresov@1051 443 } else {
johnc@2060 444
johnc@2060 445 CardTableModRefBS* bs = (CardTableModRefBS*)_g1->barrier_set();
johnc@2060 446 UpdateRSetCardTableEntryIntoCSetClosure update_rs_cset_immediate(_g1, bs);
johnc@2060 447
johnc@2060 448 int n_completed_buffers = 0;
johnc@2060 449 while (into_cset_dcqs.apply_closure_to_completed_buffer(&update_rs_cset_immediate,
johnc@2060 450 0, 0, true)) {
johnc@2060 451 n_completed_buffers++;
johnc@2060 452 }
johnc@2060 453 assert(n_completed_buffers == into_cset_n_buffers, "missed some buffers");
iveresov@1051 454 }
iveresov@1051 455 }
johnc@2060 456
johnc@2060 457 // Free any completed buffers in the DirtyCardQueueSet used to hold cards
johnc@2060 458 // which contain references that point into the collection.
johnc@2060 459 _g1->into_cset_dirty_card_queue_set().clear();
johnc@2060 460 assert(_g1->into_cset_dirty_card_queue_set().completed_buffers_num() == 0,
johnc@2060 461 "all buffers should be freed");
johnc@2060 462 _g1->into_cset_dirty_card_queue_set().clear_n_completed_buffers();
ysr@777 463 }
ysr@777 464
ysr@777 465 class ScrubRSClosure: public HeapRegionClosure {
ysr@777 466 G1CollectedHeap* _g1h;
ysr@777 467 BitMap* _region_bm;
ysr@777 468 BitMap* _card_bm;
ysr@777 469 CardTableModRefBS* _ctbs;
ysr@777 470 public:
ysr@777 471 ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) :
ysr@777 472 _g1h(G1CollectedHeap::heap()),
ysr@777 473 _region_bm(region_bm), _card_bm(card_bm),
ysr@777 474 _ctbs(NULL)
ysr@777 475 {
ysr@777 476 ModRefBarrierSet* bs = _g1h->mr_bs();
ysr@777 477 guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition");
ysr@777 478 _ctbs = (CardTableModRefBS*)bs;
ysr@777 479 }
ysr@777 480
ysr@777 481 bool doHeapRegion(HeapRegion* r) {
ysr@777 482 if (!r->continuesHumongous()) {
ysr@777 483 r->rem_set()->scrub(_ctbs, _region_bm, _card_bm);
ysr@777 484 }
ysr@777 485 return false;
ysr@777 486 }
ysr@777 487 };
ysr@777 488
johnc@2216 489 void G1RemSet::scrub(BitMap* region_bm, BitMap* card_bm) {
ysr@777 490 ScrubRSClosure scrub_cl(region_bm, card_bm);
ysr@777 491 _g1->heap_region_iterate(&scrub_cl);
ysr@777 492 }
ysr@777 493
johnc@2216 494 void G1RemSet::scrub_par(BitMap* region_bm, BitMap* card_bm,
jmasa@3357 495 uint worker_num, int claim_val) {
ysr@777 496 ScrubRSClosure scrub_cl(region_bm, card_bm);
jmasa@3294 497 _g1->heap_region_par_iterate_chunked(&scrub_cl,
jmasa@3294 498 worker_num,
jmasa@3357 499 n_workers(),
jmasa@3294 500 claim_val);
ysr@777 501 }
ysr@777 502
johnc@3466 503 G1TriggerClosure::G1TriggerClosure() :
johnc@3466 504 _triggered(false) { }
johnc@2060 505
johnc@3466 506 G1InvokeIfNotTriggeredClosure::G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t_cl,
johnc@3466 507 OopClosure* oop_cl) :
johnc@3466 508 _trigger_cl(t_cl), _oop_cl(oop_cl) { }
johnc@3466 509
johnc@3466 510 G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) :
johnc@3466 511 _c1(c1), _c2(c2) { }
johnc@3466 512
johnc@3466 513 G1UpdateRSOrPushRefOopClosure::
johnc@3466 514 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
johnc@3466 515 G1RemSet* rs,
johnc@3466 516 OopsInHeapRegionClosure* push_ref_cl,
johnc@3466 517 bool record_refs_into_cset,
johnc@3466 518 int worker_i) :
johnc@3466 519 _g1(g1h), _g1_rem_set(rs), _from(NULL),
johnc@3466 520 _record_refs_into_cset(record_refs_into_cset),
johnc@3466 521 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { }
johnc@2060 522
johnc@5078 523 // Returns true if the given card contains references that point
johnc@5078 524 // into the collection set, if we're checking for such references;
johnc@5078 525 // false otherwise.
johnc@5078 526
johnc@5078 527 bool G1RemSet::refine_card(jbyte* card_ptr, int worker_i,
johnc@5078 528 bool check_for_refs_into_cset) {
johnc@5078 529
johnc@5078 530 // If the card is no longer dirty, nothing to do.
johnc@5078 531 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
johnc@5078 532 // No need to return that this card contains refs that point
johnc@5078 533 // into the collection set.
johnc@5078 534 return false;
johnc@5078 535 }
johnc@5078 536
johnc@1325 537 // Construct the region representing the card.
johnc@1325 538 HeapWord* start = _ct_bs->addr_for(card_ptr);
johnc@1325 539 // And find the region containing it.
johnc@1325 540 HeapRegion* r = _g1->heap_region_containing(start);
johnc@5078 541 if (r == NULL) {
johnc@5078 542 // Again no need to return that this card contains refs that
johnc@5078 543 // point into the collection set.
johnc@5078 544 return false; // Not in the G1 heap (might be in perm, for example.)
johnc@5078 545 }
johnc@5078 546
johnc@5078 547 // Why do we have to check here whether a card is on a young region,
johnc@5078 548 // given that we dirty young regions and, as a result, the
johnc@5078 549 // post-barrier is supposed to filter them out and never to enqueue
johnc@5078 550 // them? When we allocate a new region as the "allocation region" we
johnc@5078 551 // actually dirty its cards after we release the lock, since card
johnc@5078 552 // dirtying while holding the lock was a performance bottleneck. So,
johnc@5078 553 // as a result, it is possible for other threads to actually
johnc@5078 554 // allocate objects in the region (after the acquire the lock)
johnc@5078 555 // before all the cards on the region are dirtied. This is unlikely,
johnc@5078 556 // and it doesn't happen often, but it can happen. So, the extra
johnc@5078 557 // check below filters out those cards.
johnc@5078 558 if (r->is_young()) {
johnc@5078 559 return false;
johnc@5078 560 }
johnc@5078 561
johnc@5078 562 // While we are processing RSet buffers during the collection, we
johnc@5078 563 // actually don't want to scan any cards on the collection set,
johnc@5078 564 // since we don't want to update remebered sets with entries that
johnc@5078 565 // point into the collection set, given that live objects from the
johnc@5078 566 // collection set are about to move and such entries will be stale
johnc@5078 567 // very soon. This change also deals with a reliability issue which
johnc@5078 568 // involves scanning a card in the collection set and coming across
johnc@5078 569 // an array that was being chunked and looking malformed. Note,
johnc@5078 570 // however, that if evacuation fails, we have to scan any objects
johnc@5078 571 // that were not moved and create any missing entries.
johnc@5078 572 if (r->in_collection_set()) {
johnc@5078 573 return false;
johnc@5078 574 }
johnc@5078 575
johnc@5078 576 // The result from the hot card cache insert call is either:
johnc@5078 577 // * pointer to the current card
johnc@5078 578 // (implying that the current card is not 'hot'),
johnc@5078 579 // * null
johnc@5078 580 // (meaning we had inserted the card ptr into the "hot" card cache,
johnc@5078 581 // which had some headroom),
johnc@5078 582 // * a pointer to a "hot" card that was evicted from the "hot" cache.
johnc@5078 583 //
johnc@5078 584
johnc@5078 585 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
johnc@5078 586 if (hot_card_cache->use_cache()) {
johnc@5078 587 assert(!check_for_refs_into_cset, "sanity");
johnc@5078 588 assert(!SafepointSynchronize::is_at_safepoint(), "sanity");
johnc@5078 589
johnc@5078 590 card_ptr = hot_card_cache->insert(card_ptr);
johnc@5078 591 if (card_ptr == NULL) {
johnc@5078 592 // There was no eviction. Nothing to do.
johnc@5078 593 return false;
johnc@5078 594 }
johnc@5078 595
johnc@5078 596 start = _ct_bs->addr_for(card_ptr);
johnc@5078 597 r = _g1->heap_region_containing(start);
johnc@5078 598 if (r == NULL) {
johnc@5078 599 // Not in the G1 heap
johnc@5078 600 return false;
johnc@5078 601 }
johnc@5078 602
johnc@5078 603 // Checking whether the region we got back from the cache
johnc@5078 604 // is young here is inappropriate. The region could have been
johnc@5078 605 // freed, reallocated and tagged as young while in the cache.
johnc@5078 606 // Hence we could see its young type change at any time.
johnc@5078 607 }
johnc@1325 608
coleenp@4037 609 // Don't use addr_for(card_ptr + 1) which can ask for
coleenp@4037 610 // a card beyond the heap. This is not safe without a perm
coleenp@4037 611 // gen at the upper end of the heap.
coleenp@4037 612 HeapWord* end = start + CardTableModRefBS::card_size_in_words;
johnc@1325 613 MemRegion dirtyRegion(start, end);
johnc@1325 614
johnc@1325 615 #if CARD_REPEAT_HISTO
johnc@2504 616 init_ct_freq_table(_g1->max_capacity());
johnc@1325 617 ct_freq_note_card(_ct_bs->index_for(start));
johnc@1325 618 #endif
johnc@1325 619
brutisso@3267 620 OopsInHeapRegionClosure* oops_in_heap_closure = NULL;
brutisso@3267 621 if (check_for_refs_into_cset) {
brutisso@3267 622 // ConcurrentG1RefineThreads have worker numbers larger than what
brutisso@3267 623 // _cset_rs_update_cl[] is set up to handle. But those threads should
brutisso@3267 624 // only be active outside of a collection which means that when they
brutisso@3267 625 // reach here they should have check_for_refs_into_cset == false.
brutisso@3267 626 assert((size_t)worker_i < n_workers(), "index of worker larger than _cset_rs_update_cl[].length");
brutisso@3267 627 oops_in_heap_closure = _cset_rs_update_cl[worker_i];
brutisso@3267 628 }
johnc@3466 629 G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1,
johnc@3466 630 _g1->g1_rem_set(),
johnc@3466 631 oops_in_heap_closure,
johnc@3466 632 check_for_refs_into_cset,
johnc@3466 633 worker_i);
johnc@1325 634 update_rs_oop_cl.set_from(r);
johnc@2060 635
johnc@3466 636 G1TriggerClosure trigger_cl;
johnc@3179 637 FilterIntoCSClosure into_cs_cl(NULL, _g1, &trigger_cl);
johnc@3466 638 G1InvokeIfNotTriggeredClosure invoke_cl(&trigger_cl, &into_cs_cl);
johnc@3466 639 G1Mux2Closure mux(&invoke_cl, &update_rs_oop_cl);
johnc@2060 640
johnc@2060 641 FilterOutOfRegionClosure filter_then_update_rs_oop_cl(r,
johnc@2060 642 (check_for_refs_into_cset ?
johnc@2060 643 (OopClosure*)&mux :
johnc@2060 644 (OopClosure*)&update_rs_oop_cl));
johnc@1325 645
johnc@2021 646 // The region for the current card may be a young region. The
johnc@2021 647 // current card may have been a card that was evicted from the
johnc@2021 648 // card cache. When the card was inserted into the cache, we had
johnc@2021 649 // determined that its region was non-young. While in the cache,
johnc@2021 650 // the region may have been freed during a cleanup pause, reallocated
johnc@2021 651 // and tagged as young.
johnc@2021 652 //
johnc@2021 653 // We wish to filter out cards for such a region but the current
tonyp@2849 654 // thread, if we're running concurrently, may "see" the young type
johnc@2021 655 // change at any time (so an earlier "is_young" check may pass or
johnc@2021 656 // fail arbitrarily). We tell the iteration code to perform this
johnc@2021 657 // filtering when it has been determined that there has been an actual
johnc@2021 658 // allocation in this region and making it safe to check the young type.
johnc@2021 659 bool filter_young = true;
johnc@2021 660
johnc@1325 661 HeapWord* stop_point =
johnc@1325 662 r->oops_on_card_seq_iterate_careful(dirtyRegion,
johnc@2021 663 &filter_then_update_rs_oop_cl,
tonyp@2849 664 filter_young,
tonyp@2849 665 card_ptr);
johnc@2021 666
johnc@1325 667 // If stop_point is non-null, then we encountered an unallocated region
johnc@1325 668 // (perhaps the unfilled portion of a TLAB.) For now, we'll dirty the
johnc@1325 669 // card and re-enqueue: if we put off the card until a GC pause, then the
johnc@1325 670 // unallocated portion will be filled in. Alternatively, we might try
johnc@1325 671 // the full complexity of the technique used in "regular" precleaning.
johnc@1325 672 if (stop_point != NULL) {
johnc@1325 673 // The card might have gotten re-dirtied and re-enqueued while we
johnc@1325 674 // worked. (In fact, it's pretty likely.)
johnc@1325 675 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
johnc@1325 676 *card_ptr = CardTableModRefBS::dirty_card_val();
johnc@1325 677 MutexLockerEx x(Shared_DirtyCardQ_lock,
johnc@1325 678 Mutex::_no_safepoint_check_flag);
johnc@1325 679 DirtyCardQueue* sdcq =
johnc@1325 680 JavaThread::dirty_card_queue_set().shared_dirty_card_queue();
johnc@1325 681 sdcq->enqueue(card_ptr);
johnc@1325 682 }
johnc@1325 683 } else {
johnc@1325 684 _conc_refine_cards++;
johnc@1325 685 }
johnc@2060 686
johnc@5078 687 // This gets set to true if the card being refined has
johnc@5078 688 // references that point into the collection set.
johnc@5078 689 bool has_refs_into_cset = trigger_cl.triggered();
johnc@1325 690
johnc@5078 691 // We should only be detecting that the card contains references
johnc@5078 692 // that point into the collection set if the current thread is
johnc@5078 693 // a GC worker thread.
johnc@5078 694 assert(!has_refs_into_cset || SafepointSynchronize::is_at_safepoint(),
johnc@5078 695 "invalid result at non safepoint");
ysr@777 696
johnc@5078 697 return has_refs_into_cset;
ysr@777 698 }
ysr@777 699
ysr@777 700 class HRRSStatsIter: public HeapRegionClosure {
ysr@777 701 size_t _occupied;
ysr@777 702 size_t _total_mem_sz;
ysr@777 703 size_t _max_mem_sz;
ysr@777 704 HeapRegion* _max_mem_sz_region;
ysr@777 705 public:
ysr@777 706 HRRSStatsIter() :
ysr@777 707 _occupied(0),
ysr@777 708 _total_mem_sz(0),
ysr@777 709 _max_mem_sz(0),
ysr@777 710 _max_mem_sz_region(NULL)
ysr@777 711 {}
ysr@777 712
ysr@777 713 bool doHeapRegion(HeapRegion* r) {
ysr@777 714 if (r->continuesHumongous()) return false;
ysr@777 715 size_t mem_sz = r->rem_set()->mem_size();
ysr@777 716 if (mem_sz > _max_mem_sz) {
ysr@777 717 _max_mem_sz = mem_sz;
ysr@777 718 _max_mem_sz_region = r;
ysr@777 719 }
ysr@777 720 _total_mem_sz += mem_sz;
ysr@777 721 size_t occ = r->rem_set()->occupied();
ysr@777 722 _occupied += occ;
ysr@777 723 return false;
ysr@777 724 }
ysr@777 725 size_t total_mem_sz() { return _total_mem_sz; }
ysr@777 726 size_t max_mem_sz() { return _max_mem_sz; }
ysr@777 727 size_t occupied() { return _occupied; }
ysr@777 728 HeapRegion* max_mem_sz_region() { return _max_mem_sz_region; }
ysr@777 729 };
ysr@777 730
iveresov@1229 731 class PrintRSThreadVTimeClosure : public ThreadClosure {
iveresov@1229 732 public:
iveresov@1229 733 virtual void do_thread(Thread *t) {
iveresov@1229 734 ConcurrentG1RefineThread* crt = (ConcurrentG1RefineThread*) t;
iveresov@1229 735 gclog_or_tty->print(" %5.2f", crt->vtime_accum());
iveresov@1229 736 }
iveresov@1229 737 };
iveresov@1229 738
johnc@2216 739 void G1RemSet::print_summary_info() {
ysr@777 740 G1CollectedHeap* g1 = G1CollectedHeap::heap();
ysr@777 741
ysr@777 742 #if CARD_REPEAT_HISTO
ysr@777 743 gclog_or_tty->print_cr("\nG1 card_repeat count histogram: ");
ysr@777 744 gclog_or_tty->print_cr(" # of repeats --> # of cards with that number.");
ysr@777 745 card_repeat_count.print_on(gclog_or_tty);
ysr@777 746 #endif
ysr@777 747
iveresov@1229 748 gclog_or_tty->print_cr("\n Concurrent RS processed %d cards",
iveresov@1229 749 _conc_refine_cards);
ysr@777 750 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
ysr@777 751 jint tot_processed_buffers =
ysr@777 752 dcqs.processed_buffers_mut() + dcqs.processed_buffers_rs_thread();
ysr@777 753 gclog_or_tty->print_cr(" Of %d completed buffers:", tot_processed_buffers);
iveresov@1229 754 gclog_or_tty->print_cr(" %8d (%5.1f%%) by conc RS threads.",
ysr@777 755 dcqs.processed_buffers_rs_thread(),
ysr@777 756 100.0*(float)dcqs.processed_buffers_rs_thread()/
ysr@777 757 (float)tot_processed_buffers);
ysr@777 758 gclog_or_tty->print_cr(" %8d (%5.1f%%) by mutator threads.",
ysr@777 759 dcqs.processed_buffers_mut(),
ysr@777 760 100.0*(float)dcqs.processed_buffers_mut()/
ysr@777 761 (float)tot_processed_buffers);
iveresov@1229 762 gclog_or_tty->print_cr(" Conc RS threads times(s)");
iveresov@1229 763 PrintRSThreadVTimeClosure p;
iveresov@1229 764 gclog_or_tty->print(" ");
iveresov@1229 765 g1->concurrent_g1_refine()->threads_do(&p);
ysr@777 766 gclog_or_tty->print_cr("");
iveresov@1229 767
johnc@2216 768 HRRSStatsIter blk;
johnc@2216 769 g1->heap_region_iterate(&blk);
tonyp@3957 770 gclog_or_tty->print_cr(" Total heap region rem set sizes = "SIZE_FORMAT"K."
tonyp@3957 771 " Max = "SIZE_FORMAT"K.",
johnc@2216 772 blk.total_mem_sz()/K, blk.max_mem_sz()/K);
tonyp@3957 773 gclog_or_tty->print_cr(" Static structures = "SIZE_FORMAT"K,"
tonyp@3957 774 " free_lists = "SIZE_FORMAT"K.",
tonyp@3957 775 HeapRegionRemSet::static_mem_size() / K,
tonyp@3957 776 HeapRegionRemSet::fl_mem_size() / K);
tonyp@3957 777 gclog_or_tty->print_cr(" "SIZE_FORMAT" occupied cards represented.",
johnc@2216 778 blk.occupied());
tonyp@3957 779 HeapRegion* max_mem_sz_region = blk.max_mem_sz_region();
tonyp@3957 780 HeapRegionRemSet* rem_set = max_mem_sz_region->rem_set();
tonyp@3957 781 gclog_or_tty->print_cr(" Max size region = "HR_FORMAT", "
tonyp@3957 782 "size = "SIZE_FORMAT "K, occupied = "SIZE_FORMAT"K.",
tonyp@3957 783 HR_FORMAT_PARAMS(max_mem_sz_region),
tonyp@3957 784 (rem_set->mem_size() + K - 1)/K,
tonyp@3957 785 (rem_set->occupied() + K - 1)/K);
tonyp@3957 786 gclog_or_tty->print_cr(" Did %d coarsenings.",
tonyp@3957 787 HeapRegionRemSet::n_coarsenings());
ysr@777 788 }
johnc@2060 789
johnc@2216 790 void G1RemSet::prepare_for_verify() {
iveresov@1072 791 if (G1HRRSFlushLogBuffersOnVerify &&
iveresov@1072 792 (VerifyBeforeGC || VerifyAfterGC)
iveresov@1072 793 && !_g1->full_collection()) {
ysr@777 794 cleanupHRRS();
ysr@777 795 _g1->set_refine_cte_cl_concurrency(false);
ysr@777 796 if (SafepointSynchronize::is_at_safepoint()) {
ysr@777 797 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
ysr@777 798 dcqs.concatenate_logs();
ysr@777 799 }
johnc@5078 800
johnc@5078 801 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
johnc@5078 802 bool use_hot_card_cache = hot_card_cache->use_cache();
johnc@5078 803 hot_card_cache->set_use_cache(false);
johnc@5078 804
johnc@2060 805 DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
johnc@2060 806 updateRS(&into_cset_dcq, 0);
johnc@2060 807 _g1->into_cset_dirty_card_queue_set().clear();
iveresov@1072 808
johnc@5078 809 hot_card_cache->set_use_cache(use_hot_card_cache);
iveresov@1072 810 assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
ysr@777 811 }
ysr@777 812 }

mercurial