1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/g1/concurrentG1Refine.hpp"
27 #include "gc/g1/concurrentG1RefineThread.hpp"
28 #include "gc/g1/dirtyCardQueue.hpp"
29 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
30 #include "gc/g1/g1CollectedHeap.inline.hpp"
31 #include "gc/g1/g1CollectorPolicy.hpp"
32 #include "gc/g1/g1FromCardCache.hpp"
33 #include "gc/g1/g1GCPhaseTimes.hpp"
34 #include "gc/g1/g1HotCardCache.hpp"
35 #include "gc/g1/g1OopClosures.inline.hpp"
36 #include "gc/g1/g1RemSet.inline.hpp"
37 #include "gc/g1/g1SATBCardTableModRefBS.inline.hpp"
38 #include "gc/g1/heapRegion.inline.hpp"
39 #include "gc/g1/heapRegionManager.inline.hpp"
40 #include "gc/g1/heapRegionRemSet.hpp"
41 #include "memory/iterator.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "utilities/globalDefinitions.hpp"
44 #include "utilities/intHisto.hpp"
45 #include "utilities/stack.inline.hpp"
46
47 G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) :
48 _g1(g1),
49 _conc_refine_cards(0),
50 _ct_bs(ct_bs),
51 _g1p(_g1->g1_policy()),
52 _cg1r(g1->concurrent_g1_refine()),
53 _cset_rs_update_cl(NULL),
54 _prev_period_summary(),
55 _into_cset_dirty_card_queue_set(false)
56 {
57 _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
58 for (uint i = 0; i < n_workers(); i++) {
59 _cset_rs_update_cl[i] = NULL;
60 }
61 if (log_is_enabled(Trace, gc, remset)) {
62 _prev_period_summary.initialize(this);
63 }
64 // Initialize the card queue set used to hold cards containing
65 // references into the collection set.
66 _into_cset_dirty_card_queue_set.initialize(NULL, // Should never be called by the Java code
67 DirtyCardQ_CBL_mon,
68 DirtyCardQ_FL_lock,
69 -1, // never trigger processing
70 -1, // no limit on length
71 Shared_DirtyCardQ_lock,
72 &JavaThread::dirty_card_queue_set());
73 }
74
75 G1RemSet::~G1RemSet() {
76 for (uint i = 0; i < n_workers(); i++) {
77 assert(_cset_rs_update_cl[i] == NULL, "it should be");
78 }
79 FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl);
80 }
81
82 uint G1RemSet::num_par_rem_sets() {
83 return MAX2(DirtyCardQueueSet::num_par_ids() + ConcurrentG1Refine::thread_num(), ParallelGCThreads);
84 }
85
86 void G1RemSet::initialize(uint max_regions) {
87 G1FromCardCache::initialize(num_par_rem_sets(), max_regions);
88 }
89
90 ScanRSClosure::ScanRSClosure(G1ParPushHeapRSClosure* oc,
91 CodeBlobClosure* code_root_cl,
92 uint worker_i) :
93 _oc(oc),
94 _code_root_cl(code_root_cl),
95 _strong_code_root_scan_time_sec(0.0),
96 _cards(0),
97 _cards_done(0),
98 _worker_i(worker_i),
99 _try_claimed(false) {
100 _g1h = G1CollectedHeap::heap();
101 _bot = _g1h->bot();
102 _ct_bs = _g1h->g1_barrier_set();
103 _block_size = MAX2<size_t>(G1RSetScanBlockSize, 1);
104 }
105
106 void ScanRSClosure::scanCard(size_t index, HeapRegion *r) {
107 // Stack allocate the DirtyCardToOopClosure instance
108 HeapRegionDCTOC cl(_g1h, r, _oc,
109 CardTableModRefBS::Precise);
110
111 // Set the "from" region in the closure.
112 _oc->set_region(r);
113 MemRegion card_region(_bot->address_for_index(index), BOTConstants::N_words);
114 MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
115 MemRegion mr = pre_gc_allocated.intersection(card_region);
116 if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
117 // We make the card as "claimed" lazily (so races are possible
118 // but they're benign), which reduces the number of duplicate
119 // scans (the rsets of the regions in the cset can intersect).
120 _ct_bs->set_card_claimed(index);
121 _cards_done++;
122 cl.do_MemRegion(mr);
123 }
124 }
125
126 void ScanRSClosure::scan_strong_code_roots(HeapRegion* r) {
127 double scan_start = os::elapsedTime();
128 r->strong_code_roots_do(_code_root_cl);
129 _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start);
130 }
131
132 bool ScanRSClosure::doHeapRegion(HeapRegion* r) {
133 assert(r->in_collection_set(), "should only be called on elements of CS.");
134 HeapRegionRemSet* hrrs = r->rem_set();
135 if (hrrs->iter_is_complete()) return false; // All done.
136 if (!_try_claimed && !hrrs->claim_iter()) return false;
137 // If we ever free the collection set concurrently, we should also
138 // clear the card table concurrently therefore we won't need to
139 // add regions of the collection set to the dirty cards region.
140 _g1h->push_dirty_cards_region(r);
141 // If we didn't return above, then
142 // _try_claimed || r->claim_iter()
143 // is true: either we're supposed to work on claimed-but-not-complete
144 // regions, or we successfully claimed the region.
145
146 HeapRegionRemSetIterator iter(hrrs);
147 size_t card_index;
148
149 // We claim cards in block so as to reduce the contention. The block size is determined by
150 // the G1RSetScanBlockSize parameter.
151 size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
152 for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
153 if (current_card >= jump_to_card + _block_size) {
154 jump_to_card = hrrs->iter_claimed_next(_block_size);
155 }
156 if (current_card < jump_to_card) continue;
157 HeapWord* card_start = _g1h->bot()->address_for_index(card_index);
158
159 HeapRegion* card_region = _g1h->heap_region_containing(card_start);
160 _cards++;
161
162 if (!card_region->is_on_dirty_cards_region_list()) {
163 _g1h->push_dirty_cards_region(card_region);
164 }
165
166 // If the card is dirty, then we will scan it during updateRS.
167 if (!card_region->in_collection_set() &&
168 !_ct_bs->is_card_dirty(card_index)) {
169 scanCard(card_index, card_region);
170 }
171 }
172 if (!_try_claimed) {
173 // Scan the strong code root list attached to the current region
174 scan_strong_code_roots(r);
175
176 hrrs->set_iter_complete();
177 }
178 return false;
179 }
180
181 size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
182 CodeBlobClosure* heap_region_codeblobs,
183 uint worker_i) {
184 double rs_time_start = os::elapsedTime();
185
186 HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
187
188 ScanRSClosure scanRScl(oc, heap_region_codeblobs, worker_i);
189
190 _g1->collection_set_iterate_from(startRegion, &scanRScl);
191 scanRScl.set_try_claimed();
192 _g1->collection_set_iterate_from(startRegion, &scanRScl);
193
194 double scan_rs_time_sec = (os::elapsedTime() - rs_time_start)
195 - scanRScl.strong_code_root_scan_time_sec();
196
197 _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec);
198 _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec());
199
200 return scanRScl.cards_done();
201 }
202
203 // Closure used for updating RSets and recording references that
204 // point into the collection set. Only called during an
205 // evacuation pause.
206
207 class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure {
208 G1RemSet* _g1rs;
209 DirtyCardQueue* _into_cset_dcq;
210 public:
211 RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h,
212 DirtyCardQueue* into_cset_dcq) :
213 _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq)
214 {}
215
216 bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
217 // The only time we care about recording cards that
218 // contain references that point into the collection set
219 // is during RSet updating within an evacuation pause.
220 // In this case worker_i should be the id of a GC worker thread.
221 assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
222 assert(worker_i < ParallelGCThreads, "should be a GC worker");
223
224 if (_g1rs->refine_card(card_ptr, worker_i, true)) {
225 // 'card_ptr' contains references that point into the collection
226 // set. We need to record the card in the DCQS
227 // (_into_cset_dirty_card_queue_set)
228 // that's used for that purpose.
229 //
230 // Enqueue the card
231 _into_cset_dcq->enqueue(card_ptr);
232 }
233 return true;
234 }
235 };
236
237 void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) {
238 RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq);
239
240 G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
241 {
242 // Apply the closure to the entries of the hot card cache.
243 G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);
244 _g1->iterate_hcc_closure(&into_cset_update_rs_cl, worker_i);
245 }
246 // Apply the closure to all remaining log entries.
247 _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, worker_i);
248 }
249
250 void G1RemSet::cleanupHRRS() {
251 HeapRegionRemSet::cleanup();
252 }
253
254 size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
255 CodeBlobClosure* heap_region_codeblobs,
256 uint worker_i) {
257 // We cache the value of 'oc' closure into the appropriate slot in the
258 // _cset_rs_update_cl for this worker
259 assert(worker_i < n_workers(), "sanity");
260 _cset_rs_update_cl[worker_i] = oc;
261
262 // A DirtyCardQueue that is used to hold cards containing references
263 // that point into the collection set. This DCQ is associated with a
264 // special DirtyCardQueueSet (see g1CollectedHeap.hpp). Under normal
265 // circumstances (i.e. the pause successfully completes), these cards
266 // are just discarded (there's no need to update the RSets of regions
267 // that were in the collection set - after the pause these regions
268 // are wholly 'free' of live objects. In the event of an evacuation
269 // failure the cards/buffers in this queue set are passed to the
270 // DirtyCardQueueSet that is used to manage RSet updates
271 DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
272
273 updateRS(&into_cset_dcq, worker_i);
274 size_t cards_scanned = scanRS(oc, heap_region_codeblobs, worker_i);
275
276 // We now clear the cached values of _cset_rs_update_cl for this worker
277 _cset_rs_update_cl[worker_i] = NULL;
278 return cards_scanned;
279 }
280
281 void G1RemSet::prepare_for_oops_into_collection_set_do() {
282 _g1->set_refine_cte_cl_concurrency(false);
283 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
284 dcqs.concatenate_logs();
285 }
286
287 void G1RemSet::cleanup_after_oops_into_collection_set_do() {
288 // Cleanup after copy
289 _g1->set_refine_cte_cl_concurrency(true);
290 // Set all cards back to clean.
291 _g1->cleanUpCardTable();
292
293 DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set;
294 int into_cset_n_buffers = into_cset_dcqs.completed_buffers_num();
295
296 if (_g1->evacuation_failed()) {
297 double restore_remembered_set_start = os::elapsedTime();
298
299 // Restore remembered sets for the regions pointing into the collection set.
300 // We just need to transfer the completed buffers from the DirtyCardQueueSet
301 // used to hold cards that contain references that point into the collection set
302 // to the DCQS used to hold the deferred RS updates.
303 _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs);
304 _g1->g1_policy()->phase_times()->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0);
305 }
306
307 // Free any completed buffers in the DirtyCardQueueSet used to hold cards
308 // which contain references that point into the collection.
309 _into_cset_dirty_card_queue_set.clear();
310 assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0,
311 "all buffers should be freed");
312 _into_cset_dirty_card_queue_set.clear_n_completed_buffers();
313 }
314
315 class ScrubRSClosure: public HeapRegionClosure {
316 G1CollectedHeap* _g1h;
317 BitMap* _region_bm;
318 BitMap* _card_bm;
319 CardTableModRefBS* _ctbs;
320 public:
321 ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) :
322 _g1h(G1CollectedHeap::heap()),
323 _region_bm(region_bm), _card_bm(card_bm),
324 _ctbs(_g1h->g1_barrier_set()) {}
325
326 bool doHeapRegion(HeapRegion* r) {
327 if (!r->is_continues_humongous()) {
328 r->rem_set()->scrub(_ctbs, _region_bm, _card_bm);
329 }
330 return false;
331 }
332 };
333
334 void G1RemSet::scrub(BitMap* region_bm, BitMap* card_bm, uint worker_num, HeapRegionClaimer *hrclaimer) {
335 ScrubRSClosure scrub_cl(region_bm, card_bm);
336 _g1->heap_region_par_iterate(&scrub_cl, worker_num, hrclaimer);
337 }
338
339 G1TriggerClosure::G1TriggerClosure() :
340 _triggered(false) { }
341
342 G1InvokeIfNotTriggeredClosure::G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t_cl,
343 OopClosure* oop_cl) :
344 _trigger_cl(t_cl), _oop_cl(oop_cl) { }
345
346 G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) :
347 _c1(c1), _c2(c2) { }
348
349 G1UpdateRSOrPushRefOopClosure::
350 G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
351 G1RemSet* rs,
352 G1ParPushHeapRSClosure* push_ref_cl,
353 bool record_refs_into_cset,
354 uint worker_i) :
355 _g1(g1h), _g1_rem_set(rs), _from(NULL),
356 _record_refs_into_cset(record_refs_into_cset),
357 _push_ref_cl(push_ref_cl), _worker_i(worker_i) { }
358
359 // Returns true if the given card contains references that point
360 // into the collection set, if we're checking for such references;
361 // false otherwise.
362
363 bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i,
364 bool check_for_refs_into_cset) {
365 assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)),
366 "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap",
367 p2i(card_ptr),
368 _ct_bs->index_for(_ct_bs->addr_for(card_ptr)),
369 p2i(_ct_bs->addr_for(card_ptr)),
370 _g1->addr_to_region(_ct_bs->addr_for(card_ptr)));
371
372 // If the card is no longer dirty, nothing to do.
373 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
374 // No need to return that this card contains refs that point
375 // into the collection set.
376 return false;
377 }
378
379 // Construct the region representing the card.
380 HeapWord* start = _ct_bs->addr_for(card_ptr);
381 // And find the region containing it.
382 HeapRegion* r = _g1->heap_region_containing(start);
383
384 // Why do we have to check here whether a card is on a young region,
385 // given that we dirty young regions and, as a result, the
386 // post-barrier is supposed to filter them out and never to enqueue
387 // them? When we allocate a new region as the "allocation region" we
388 // actually dirty its cards after we release the lock, since card
389 // dirtying while holding the lock was a performance bottleneck. So,
390 // as a result, it is possible for other threads to actually
391 // allocate objects in the region (after the acquire the lock)
392 // before all the cards on the region are dirtied. This is unlikely,
393 // and it doesn't happen often, but it can happen. So, the extra
394 // check below filters out those cards.
395 if (r->is_young()) {
396 return false;
397 }
398
399 // While we are processing RSet buffers during the collection, we
400 // actually don't want to scan any cards on the collection set,
401 // since we don't want to update remembered sets with entries that
402 // point into the collection set, given that live objects from the
403 // collection set are about to move and such entries will be stale
404 // very soon. This change also deals with a reliability issue which
405 // involves scanning a card in the collection set and coming across
406 // an array that was being chunked and looking malformed. Note,
407 // however, that if evacuation fails, we have to scan any objects
408 // that were not moved and create any missing entries.
409 if (r->in_collection_set()) {
410 return false;
411 }
412
413 // The result from the hot card cache insert call is either:
414 // * pointer to the current card
415 // (implying that the current card is not 'hot'),
416 // * null
417 // (meaning we had inserted the card ptr into the "hot" card cache,
418 // which had some headroom),
419 // * a pointer to a "hot" card that was evicted from the "hot" cache.
420 //
421
422 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
423 if (hot_card_cache->use_cache()) {
424 assert(!check_for_refs_into_cset, "sanity");
425 assert(!SafepointSynchronize::is_at_safepoint(), "sanity");
426
427 card_ptr = hot_card_cache->insert(card_ptr);
428 if (card_ptr == NULL) {
429 // There was no eviction. Nothing to do.
430 return false;
431 }
432
433 start = _ct_bs->addr_for(card_ptr);
434 r = _g1->heap_region_containing(start);
435
436 // Checking whether the region we got back from the cache
437 // is young here is inappropriate. The region could have been
438 // freed, reallocated and tagged as young while in the cache.
439 // Hence we could see its young type change at any time.
440 }
441
442 // Don't use addr_for(card_ptr + 1) which can ask for
443 // a card beyond the heap. This is not safe without a perm
444 // gen at the upper end of the heap.
445 HeapWord* end = start + CardTableModRefBS::card_size_in_words;
446 MemRegion dirtyRegion(start, end);
447
448 G1ParPushHeapRSClosure* oops_in_heap_closure = NULL;
449 if (check_for_refs_into_cset) {
450 // ConcurrentG1RefineThreads have worker numbers larger than what
451 // _cset_rs_update_cl[] is set up to handle. But those threads should
452 // only be active outside of a collection which means that when they
453 // reach here they should have check_for_refs_into_cset == false.
454 assert((size_t)worker_i < n_workers(), "index of worker larger than _cset_rs_update_cl[].length");
455 oops_in_heap_closure = _cset_rs_update_cl[worker_i];
456 }
457 G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1,
458 _g1->g1_rem_set(),
459 oops_in_heap_closure,
460 check_for_refs_into_cset,
461 worker_i);
462 update_rs_oop_cl.set_from(r);
463
464 G1TriggerClosure trigger_cl;
465 FilterIntoCSClosure into_cs_cl(_g1, &trigger_cl);
466 G1InvokeIfNotTriggeredClosure invoke_cl(&trigger_cl, &into_cs_cl);
467 G1Mux2Closure mux(&invoke_cl, &update_rs_oop_cl);
468
469 FilterOutOfRegionClosure filter_then_update_rs_oop_cl(r,
470 (check_for_refs_into_cset ?
471 (OopClosure*)&mux :
472 (OopClosure*)&update_rs_oop_cl));
473
474 // The region for the current card may be a young region. The
475 // current card may have been a card that was evicted from the
476 // card cache. When the card was inserted into the cache, we had
477 // determined that its region was non-young. While in the cache,
478 // the region may have been freed during a cleanup pause, reallocated
479 // and tagged as young.
480 //
481 // We wish to filter out cards for such a region but the current
482 // thread, if we're running concurrently, may "see" the young type
483 // change at any time (so an earlier "is_young" check may pass or
484 // fail arbitrarily). We tell the iteration code to perform this
485 // filtering when it has been determined that there has been an actual
486 // allocation in this region and making it safe to check the young type.
487 bool filter_young = true;
488
489 HeapWord* stop_point =
490 r->oops_on_card_seq_iterate_careful(dirtyRegion,
491 &filter_then_update_rs_oop_cl,
492 filter_young,
493 card_ptr);
494
495 // If stop_point is non-null, then we encountered an unallocated region
496 // (perhaps the unfilled portion of a TLAB.) For now, we'll dirty the
497 // card and re-enqueue: if we put off the card until a GC pause, then the
498 // unallocated portion will be filled in. Alternatively, we might try
499 // the full complexity of the technique used in "regular" precleaning.
500 if (stop_point != NULL) {
501 // The card might have gotten re-dirtied and re-enqueued while we
502 // worked. (In fact, it's pretty likely.)
503 if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
504 *card_ptr = CardTableModRefBS::dirty_card_val();
505 MutexLockerEx x(Shared_DirtyCardQ_lock,
506 Mutex::_no_safepoint_check_flag);
507 DirtyCardQueue* sdcq =
508 JavaThread::dirty_card_queue_set().shared_dirty_card_queue();
509 sdcq->enqueue(card_ptr);
510 }
511 } else {
512 _conc_refine_cards++;
513 }
514
515 // This gets set to true if the card being refined has
516 // references that point into the collection set.
517 bool has_refs_into_cset = trigger_cl.triggered();
518
519 // We should only be detecting that the card contains references
520 // that point into the collection set if the current thread is
521 // a GC worker thread.
522 assert(!has_refs_into_cset || SafepointSynchronize::is_at_safepoint(),
523 "invalid result at non safepoint");
524
525 return has_refs_into_cset;
526 }
527
528 void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
529 if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
530 (period_count % G1SummarizeRSetStatsPeriod == 0)) {
531
532 if (!_prev_period_summary.initialized()) {
533 _prev_period_summary.initialize(this);
534 }
535
536 G1RemSetSummary current;
537 current.initialize(this);
538 _prev_period_summary.subtract_from(¤t);
539
540 LogHandle(gc, remset) log;
541 log.trace("%s", header);
542 ResourceMark rm;
543 _prev_period_summary.print_on(log.trace_stream());
544
545 _prev_period_summary.set(¤t);
546 }
547 }
548
549 void G1RemSet::print_summary_info() {
550 LogHandle(gc, remset, exit) log;
551 if (log.is_trace()) {
552 log.trace(" Cumulative RS summary");
553 G1RemSetSummary current;
554 current.initialize(this);
555 ResourceMark rm;
556 current.print_on(log.trace_stream());
557 }
558 }
559
560 void G1RemSet::prepare_for_verify() {
561 if (G1HRRSFlushLogBuffersOnVerify &&
562 (VerifyBeforeGC || VerifyAfterGC)
563 && (!_g1->collector_state()->full_collection() || G1VerifyRSetsDuringFullGC)) {
564 cleanupHRRS();
565 _g1->set_refine_cte_cl_concurrency(false);
566 if (SafepointSynchronize::is_at_safepoint()) {
567 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
568 dcqs.concatenate_logs();
569 }
570
571 G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
572 bool use_hot_card_cache = hot_card_cache->use_cache();
573 hot_card_cache->set_use_cache(false);
574
575 DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
576 updateRS(&into_cset_dcq, 0);
577 _into_cset_dirty_card_queue_set.clear();
578
579 hot_card_cache->set_use_cache(use_hot_card_cache);
580 assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
581 }
582 }
--- EOF ---