hotspot/src/share/vm/gc/g1/g1RemSet.cpp
author tschatzl
Wed, 06 Apr 2016 13:41:59 +0200
changeset 37414 2672ba9af0dc
parent 37248 11a660dbbb8e
child 37985 539c597ee0fa
permissions -rw-r--r--
8151386: Extract card live data out of G1ConcurrentMark Summary: Move card live data management out of G1ConcurrentMark into extra class G1CardLiveData managed by G1RemSet Reviewed-by: mgerdin, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     1
/*
35469
17ea1b453dd5 8146694: Break out shared constants and static BOT functions.
david
parents: 35461
diff changeset
     2
 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     4
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     8
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    13
 * accompanied this code).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    14
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5033
diff changeset
    21
 * questions.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    22
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    23
 */
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7385
diff changeset
    25
#include "precompiled.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    26
#include "gc/g1/concurrentG1Refine.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    27
#include "gc/g1/concurrentG1RefineThread.hpp"
35210
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    28
#include "gc/g1/dirtyCardQueue.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    29
#include "gc/g1/g1BlockOffsetTable.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    30
#include "gc/g1/g1CollectedHeap.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    31
#include "gc/g1/g1CollectorPolicy.hpp"
35210
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    32
#include "gc/g1/g1FromCardCache.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    33
#include "gc/g1/g1GCPhaseTimes.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    34
#include "gc/g1/g1HotCardCache.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    35
#include "gc/g1/g1OopClosures.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    36
#include "gc/g1/g1RemSet.inline.hpp"
35862
411842d0c882 8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents: 35469
diff changeset
    37
#include "gc/g1/g1SATBCardTableModRefBS.inline.hpp"
35198
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    38
#include "gc/g1/heapRegion.inline.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    39
#include "gc/g1/heapRegionManager.inline.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 30175
diff changeset
    40
#include "gc/g1/heapRegionRemSet.hpp"
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    41
#include "gc/shared/gcTraceTime.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7385
diff changeset
    42
#include "memory/iterator.hpp"
37248
11a660dbbb8e 8132524: Missing includes to resourceArea.hpp
jprovino
parents: 37242
diff changeset
    43
#include "memory/resourceArea.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7385
diff changeset
    44
#include "oops/oop.inline.hpp"
24098
48f07e2c74de 8039957: Replace the last few %p usages with PTR_FORMAT in the GC code
stefank
parents: 23858
diff changeset
    45
#include "utilities/globalDefinitions.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7385
diff changeset
    46
#include "utilities/intHisto.hpp"
30175
543725014c9d 8076457: Fix includes of inline.hpp in GC code
stefank
parents: 29796
diff changeset
    47
#include "utilities/stack.inline.hpp"
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    48
35198
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    49
G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) :
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    50
  _g1(g1),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    51
  _conc_refine_cards(0),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    52
  _ct_bs(ct_bs),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    53
  _g1p(_g1->g1_policy()),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    54
  _cg1r(g1->concurrent_g1_refine()),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    55
  _cset_rs_update_cl(NULL),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    56
  _prev_period_summary(),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
    57
  _into_cset_dirty_card_queue_set(false)
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    58
{
28207
6ad23566cbef 8067655: Clean up G1 remembered set oop iteration
mgerdin
parents: 27905
diff changeset
    59
  _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
    60
  for (uint i = 0; i < n_workers(); i++) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
    61
    _cset_rs_update_cl[i] = NULL;
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
    62
  }
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
    63
  if (log_is_enabled(Trace, gc, remset)) {
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents: 20309
diff changeset
    64
    _prev_period_summary.initialize(this);
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents: 20309
diff changeset
    65
  }
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    66
  // Initialize the card queue set used to hold cards containing
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    67
  // references into the collection set.
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    68
  _into_cset_dirty_card_queue_set.initialize(NULL, // Should never be called by the Java code
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    69
                                             DirtyCardQ_CBL_mon,
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    70
                                             DirtyCardQ_FL_lock,
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    71
                                             -1, // never trigger processing
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    72
                                             -1, // no limit on length
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    73
                                             Shared_DirtyCardQ_lock,
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
    74
                                             &JavaThread::dirty_card_queue_set());
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    75
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    76
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
    77
G1RemSet::~G1RemSet() {
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
    78
  for (uint i = 0; i < n_workers(); i++) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
    79
    assert(_cset_rs_update_cl[i] == NULL, "it should be");
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
    80
  }
28207
6ad23566cbef 8067655: Clean up G1 remembered set oop iteration
mgerdin
parents: 27905
diff changeset
    81
  FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    82
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    83
35210
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    84
uint G1RemSet::num_par_rem_sets() {
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    85
  return MAX2(DirtyCardQueueSet::num_par_ids() + ConcurrentG1Refine::thread_num(), ParallelGCThreads);
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    86
}
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    87
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    88
void G1RemSet::initialize(size_t capacity, uint max_regions) {
35210
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    89
  G1FromCardCache::initialize(num_par_rem_sets(), max_regions);
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    90
  {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    91
    GCTraceTime(Debug, gc, marking)("Initialize Card Live Data");
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    92
    _card_live_data.initialize(capacity, max_regions);
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    93
  }
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    94
  if (G1PretouchAuxiliaryMemory) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    95
    GCTraceTime(Debug, gc, marking)("Pre-Touch Card Live Data");
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    96
    _card_live_data.pretouch();
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
    97
  }
35210
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    98
}
eb1d5c68bf64 8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents: 35198
diff changeset
    99
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   100
ScanRSClosure::ScanRSClosure(G1ParPushHeapRSClosure* oc,
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   101
                             CodeBlobClosure* code_root_cl,
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   102
                             uint worker_i) :
35198
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   103
  _oc(oc),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   104
  _code_root_cl(code_root_cl),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   105
  _strong_code_root_scan_time_sec(0.0),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   106
  _cards(0),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   107
  _cards_done(0),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   108
  _worker_i(worker_i),
1365be812a7d 8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents: 35068
diff changeset
   109
  _try_claimed(false) {
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   110
  _g1h = G1CollectedHeap::heap();
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 35210
diff changeset
   111
  _bot = _g1h->bot();
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   112
  _ct_bs = _g1h->g1_barrier_set();
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   113
  _block_size = MAX2<size_t>(G1RSetScanBlockSize, 1);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   114
}
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   115
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   116
void ScanRSClosure::scanCard(size_t index, HeapRegion *r) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   117
  // Stack allocate the DirtyCardToOopClosure instance
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   118
  HeapRegionDCTOC cl(_g1h, r, _oc,
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   119
      CardTableModRefBS::Precise);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   120
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   121
  // Set the "from" region in the closure.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   122
  _oc->set_region(r);
35469
17ea1b453dd5 8146694: Break out shared constants and static BOT functions.
david
parents: 35461
diff changeset
   123
  MemRegion card_region(_bot->address_for_index(index), BOTConstants::N_words);
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   124
  MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   125
  MemRegion mr = pre_gc_allocated.intersection(card_region);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   126
  if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   127
    // We make the card as "claimed" lazily (so races are possible
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   128
    // but they're benign), which reduces the number of duplicate
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   129
    // scans (the rsets of the regions in the cset can intersect).
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   130
    _ct_bs->set_card_claimed(index);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   131
    _cards_done++;
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   132
    cl.do_MemRegion(mr);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   133
  }
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   134
}
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   135
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   136
void ScanRSClosure::scan_strong_code_roots(HeapRegion* r) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   137
  double scan_start = os::elapsedTime();
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   138
  r->strong_code_roots_do(_code_root_cl);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   139
  _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   140
}
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   141
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   142
bool ScanRSClosure::doHeapRegion(HeapRegion* r) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   143
  assert(r->in_collection_set(), "should only be called on elements of CS.");
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   144
  HeapRegionRemSet* hrrs = r->rem_set();
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   145
  if (hrrs->iter_is_complete()) return false; // All done.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   146
  if (!_try_claimed && !hrrs->claim_iter()) return false;
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   147
  // If we ever free the collection set concurrently, we should also
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   148
  // clear the card table concurrently therefore we won't need to
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   149
  // add regions of the collection set to the dirty cards region.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   150
  _g1h->push_dirty_cards_region(r);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   151
  // If we didn't return above, then
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   152
  //   _try_claimed || r->claim_iter()
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   153
  // is true: either we're supposed to work on claimed-but-not-complete
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   154
  // regions, or we successfully claimed the region.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   155
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   156
  HeapRegionRemSetIterator iter(hrrs);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   157
  size_t card_index;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   158
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   159
  // We claim cards in block so as to reduce the contention. The block size is determined by
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   160
  // the G1RSetScanBlockSize parameter.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   161
  size_t jump_to_card = hrrs->iter_claimed_next(_block_size);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   162
  for (size_t current_card = 0; iter.has_next(card_index); current_card++) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   163
    if (current_card >= jump_to_card + _block_size) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   164
      jump_to_card = hrrs->iter_claimed_next(_block_size);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   165
    }
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   166
    if (current_card < jump_to_card) continue;
35461
1068dcb8d315 8146399: Refactor the BlockOffsetTable classes.
david
parents: 35210
diff changeset
   167
    HeapWord* card_start = _g1h->bot()->address_for_index(card_index);
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   168
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   169
    HeapRegion* card_region = _g1h->heap_region_containing(card_start);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   170
    _cards++;
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   171
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   172
    if (!card_region->is_on_dirty_cards_region_list()) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   173
      _g1h->push_dirty_cards_region(card_region);
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   174
    }
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   175
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   176
    // If the card is dirty, then we will scan it during updateRS.
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   177
    if (!card_region->in_collection_set() &&
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   178
        !_ct_bs->is_card_dirty(card_index)) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   179
      scanCard(card_index, card_region);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   180
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   181
  }
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   182
  if (!_try_claimed) {
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   183
    // Scan the strong code root list attached to the current region
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   184
    scan_strong_code_roots(r);
4902
991aaddb5165 6923991: G1: improve scalability of RSet scanning
iveresov
parents: 3590
diff changeset
   185
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   186
    hrrs->set_iter_complete();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   187
  }
34246
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   188
  return false;
d2c05216f375 8142390: Move ScanRSClosure to header file
ehelin
parents: 34135
diff changeset
   189
}
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   190
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   191
size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 33204
diff changeset
   192
                        CodeBlobClosure* heap_region_codeblobs,
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   193
                        uint worker_i) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   194
  double rs_time_start = os::elapsedTime();
32617
a59435e1fecc 8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents: 31592
diff changeset
   195
11176
9bb1ddd8da51 7112743: G1: Reduce overhead of marking closure during evacuation pauses
johnc
parents: 11174
diff changeset
   196
  HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   197
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 33204
diff changeset
   198
  ScanRSClosure scanRScl(oc, heap_region_codeblobs, worker_i);
10670
4ea0e7d2ffbc 6484982: G1: process references during evacuation pauses
johnc
parents: 10000
diff changeset
   199
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   200
  _g1->collection_set_iterate_from(startRegion, &scanRScl);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   201
  scanRScl.set_try_claimed();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   202
  _g1->collection_set_iterate_from(startRegion, &scanRScl);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   203
19339
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17855
diff changeset
   204
  double scan_rs_time_sec = (os::elapsedTime() - rs_time_start)
d247781beec7 7145569: G1: optimize nmethods scanning
johnc
parents: 17855
diff changeset
   205
                            - scanRScl.strong_code_root_scan_time_sec();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   206
29680
e5203ed6d805 8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases
brutisso
parents: 28207
diff changeset
   207
  _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec);
e5203ed6d805 8074037: Refactor the G1GCPhaseTime logging to make it easier to add new phases
brutisso
parents: 28207
diff changeset
   208
  _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec());
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   209
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   210
  return scanRScl.cards_done();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   211
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   212
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   213
// Closure used for updating RSets and recording references that
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   214
// point into the collection set. Only called during an
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   215
// evacuation pause.
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   216
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   217
class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure {
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   218
  G1RemSet* _g1rs;
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   219
  DirtyCardQueue* _into_cset_dcq;
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   220
public:
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   221
  RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h,
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   222
                                              DirtyCardQueue* into_cset_dcq) :
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   223
    _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq)
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   224
  {}
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   225
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 23455
diff changeset
   226
  bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   227
    // The only time we care about recording cards that
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   228
    // contain references that point into the collection set
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   229
    // is during RSet updating within an evacuation pause.
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   230
    // In this case worker_i should be the id of a GC worker thread.
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   231
    assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause");
27251
7d667f91ec8d 6979279: remove special-case code for ParallelGCThreads==0
mlarsson
parents: 27009
diff changeset
   232
    assert(worker_i < ParallelGCThreads, "should be a GC worker");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   233
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   234
    if (_g1rs->refine_card(card_ptr, worker_i, true)) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   235
      // 'card_ptr' contains references that point into the collection
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   236
      // set. We need to record the card in the DCQS
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   237
      // (_into_cset_dirty_card_queue_set)
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   238
      // that's used for that purpose.
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   239
      //
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   240
      // Enqueue the card
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   241
      _into_cset_dcq->enqueue(card_ptr);
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   242
    }
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   243
    return true;
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   244
  }
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   245
};
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   246
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 23455
diff changeset
   247
void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   248
  RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq);
10670
4ea0e7d2ffbc 6484982: G1: process references during evacuation pauses
johnc
parents: 10000
diff changeset
   249
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   250
  G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
36374
613f27cc37b9 8150068: Log the main G1 phases at info level
brutisso
parents: 36371
diff changeset
   251
  if (ConcurrentG1Refine::hot_card_cache_enabled()) {
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   252
    // Apply the closure to the entries of the hot card cache.
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   253
    G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   254
    _g1->iterate_hcc_closure(&into_cset_update_rs_cl, worker_i);
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   255
  }
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   256
  // Apply the closure to all remaining log entries.
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 33105
diff changeset
   257
  _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, worker_i);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   258
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   259
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
   260
void G1RemSet::cleanupHRRS() {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   261
  HeapRegionRemSet::cleanup();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   262
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   263
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   264
size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 33204
diff changeset
   265
                                             CodeBlobClosure* heap_region_codeblobs,
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   266
                                             uint worker_i) {
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   267
  // We cache the value of 'oc' closure into the appropriate slot in the
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   268
  // _cset_rs_update_cl for this worker
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 23455
diff changeset
   269
  assert(worker_i < n_workers(), "sanity");
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   270
  _cset_rs_update_cl[worker_i] = oc;
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   271
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   272
  // A DirtyCardQueue that is used to hold cards containing references
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   273
  // that point into the collection set. This DCQ is associated with a
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   274
  // special DirtyCardQueueSet (see g1CollectedHeap.hpp).  Under normal
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   275
  // circumstances (i.e. the pause successfully completes), these cards
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   276
  // are just discarded (there's no need to update the RSets of regions
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   277
  // that were in the collection set - after the pause these regions
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   278
  // are wholly 'free' of live objects. In the event of an evacuation
26701
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   279
  // failure the cards/buffers in this queue set are passed to the
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   280
  // DirtyCardQueueSet that is used to manage RSet updates
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   281
  DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   282
25909
571781915421 8051837: Remove temporary G1UseParallelRSetUpdating and G1UseParallelRSetScanning flags
brutisso
parents: 24424
diff changeset
   283
  updateRS(&into_cset_dcq, worker_i);
33213
b937f634f56e 8138762: Refactor setup of evacuation closures in G1
mgerdin
parents: 33204
diff changeset
   284
  size_t cards_scanned = scanRS(oc, heap_region_codeblobs, worker_i);
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   285
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   286
  // We now clear the cached values of _cset_rs_update_cl for this worker
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   287
  _cset_rs_update_cl[worker_i] = NULL;
32737
f02118695c2f 8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents: 32617
diff changeset
   288
  return cards_scanned;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   289
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   290
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
   291
void G1RemSet::prepare_for_oops_into_collection_set_do() {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   292
  _g1->set_refine_cte_cl_concurrency(false);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   293
  DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   294
  dcqs.concatenate_logs();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   295
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   296
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
   297
void G1RemSet::cleanup_after_oops_into_collection_set_do() {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   298
  // Cleanup after copy
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   299
  _g1->set_refine_cte_cl_concurrency(true);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   300
  // Set all cards back to clean.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   301
  _g1->cleanUpCardTable();
2881
74a1337e4acc 6484957: G1: parallel concurrent refinement
iveresov
parents: 2741
diff changeset
   302
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   303
  DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set;
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   304
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
   305
  if (_g1->evacuation_failed()) {
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 22772
diff changeset
   306
    double restore_remembered_set_start = os::elapsedTime();
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 22772
diff changeset
   307
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   308
    // Restore remembered sets for the regions pointing into the collection set.
26701
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   309
    // We just need to transfer the completed buffers from the DirtyCardQueueSet
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   310
    // used to hold cards that contain references that point into the collection set
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   311
    // to the DCQS used to hold the deferred RS updates.
f8ff74a6c058 8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents: 26422
diff changeset
   312
    _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs);
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 22772
diff changeset
   313
    _g1->g1_policy()->phase_times()->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0);
2142
032f4652700c 6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents: 2009
diff changeset
   314
  }
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   315
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   316
  // Free any completed buffers in the DirtyCardQueueSet used to hold cards
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   317
  // which contain references that point into the collection.
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   318
  _into_cset_dirty_card_queue_set.clear();
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   319
  assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0,
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   320
         "all buffers should be freed");
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   321
  _into_cset_dirty_card_queue_set.clear_n_completed_buffers();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   322
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   323
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   324
class G1ScrubRSClosure: public HeapRegionClosure {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   325
  G1CollectedHeap* _g1h;
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   326
  G1CardLiveData* _live_data;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   327
public:
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   328
  G1ScrubRSClosure(G1CardLiveData* live_data) :
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   329
    _g1h(G1CollectedHeap::heap()),
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   330
    _live_data(live_data) { }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   331
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   332
  bool doHeapRegion(HeapRegion* r) {
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26701
diff changeset
   333
    if (!r->is_continues_humongous()) {
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   334
      r->rem_set()->scrub(_live_data);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   335
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   336
    return false;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   337
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   338
};
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   339
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   340
void G1RemSet::scrub(uint worker_num, HeapRegionClaimer *hrclaimer) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   341
  G1ScrubRSClosure scrub_cl(&_card_live_data);
27009
e7e723732b6b 8058298: Separate heap region iterator claim values from the data structures iterated over
mlarsson
parents: 26846
diff changeset
   342
  _g1->heap_region_par_iterate(&scrub_cl, worker_num, hrclaimer);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   343
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   344
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   345
G1TriggerClosure::G1TriggerClosure() :
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   346
  _triggered(false) { }
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   347
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   348
G1InvokeIfNotTriggeredClosure::G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t_cl,
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   349
                                                             OopClosure* oop_cl)  :
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   350
  _trigger_cl(t_cl), _oop_cl(oop_cl) { }
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   351
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   352
G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) :
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   353
  _c1(c1), _c2(c2) { }
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   354
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   355
G1UpdateRSOrPushRefOopClosure::
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   356
G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   357
                              G1RemSet* rs,
28207
6ad23566cbef 8067655: Clean up G1 remembered set oop iteration
mgerdin
parents: 27905
diff changeset
   358
                              G1ParPushHeapRSClosure* push_ref_cl,
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   359
                              bool record_refs_into_cset,
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 23455
diff changeset
   360
                              uint worker_i) :
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   361
  _g1(g1h), _g1_rem_set(rs), _from(NULL),
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   362
  _record_refs_into_cset(record_refs_into_cset),
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   363
  _push_ref_cl(push_ref_cl), _worker_i(worker_i) { }
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   364
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   365
// Returns true if the given card contains references that point
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   366
// into the collection set, if we're checking for such references;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   367
// false otherwise.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   368
23855
c4574075402c 8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents: 23455
diff changeset
   369
bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i,
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   370
                           bool check_for_refs_into_cset) {
26160
aba6b01cb988 8038423: G1: Decommit memory within heap
tschatzl
parents: 25909
diff changeset
   371
  assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)),
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32737
diff changeset
   372
         "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap",
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32737
diff changeset
   373
         p2i(card_ptr),
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32737
diff changeset
   374
         _ct_bs->index_for(_ct_bs->addr_for(card_ptr)),
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32737
diff changeset
   375
         p2i(_ct_bs->addr_for(card_ptr)),
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32737
diff changeset
   376
         _g1->addr_to_region(_ct_bs->addr_for(card_ptr)));
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   377
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   378
  // If the card is no longer dirty, nothing to do.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   379
  if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   380
    // No need to return that this card contains refs that point
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   381
    // into the collection set.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   382
    return false;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   383
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   384
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   385
  // Construct the region representing the card.
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   386
  HeapWord* start = _ct_bs->addr_for(card_ptr);
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   387
  // And find the region containing it.
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   388
  HeapRegion* r = _g1->heap_region_containing(start);
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   389
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   390
  // Why do we have to check here whether a card is on a young region,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   391
  // given that we dirty young regions and, as a result, the
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   392
  // post-barrier is supposed to filter them out and never to enqueue
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   393
  // them? When we allocate a new region as the "allocation region" we
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   394
  // actually dirty its cards after we release the lock, since card
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   395
  // dirtying while holding the lock was a performance bottleneck. So,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   396
  // as a result, it is possible for other threads to actually
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   397
  // allocate objects in the region (after the acquire the lock)
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   398
  // before all the cards on the region are dirtied. This is unlikely,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   399
  // and it doesn't happen often, but it can happen. So, the extra
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   400
  // check below filters out those cards.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   401
  if (r->is_young()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   402
    return false;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   403
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   404
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   405
  // While we are processing RSet buffers during the collection, we
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   406
  // actually don't want to scan any cards on the collection set,
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 21560
diff changeset
   407
  // since we don't want to update remembered sets with entries that
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   408
  // point into the collection set, given that live objects from the
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   409
  // collection set are about to move and such entries will be stale
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   410
  // very soon. This change also deals with a reliability issue which
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   411
  // involves scanning a card in the collection set and coming across
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   412
  // an array that was being chunked and looking malformed. Note,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   413
  // however, that if evacuation fails, we have to scan any objects
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   414
  // that were not moved and create any missing entries.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   415
  if (r->in_collection_set()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   416
    return false;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   417
  }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   418
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   419
  // The result from the hot card cache insert call is either:
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   420
  //   * pointer to the current card
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   421
  //     (implying that the current card is not 'hot'),
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   422
  //   * null
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   423
  //     (meaning we had inserted the card ptr into the "hot" card cache,
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   424
  //     which had some headroom),
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   425
  //   * a pointer to a "hot" card that was evicted from the "hot" cache.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   426
  //
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   427
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   428
  G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   429
  if (hot_card_cache->use_cache()) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   430
    assert(!check_for_refs_into_cset, "sanity");
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   431
    assert(!SafepointSynchronize::is_at_safepoint(), "sanity");
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   432
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   433
    card_ptr = hot_card_cache->insert(card_ptr);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   434
    if (card_ptr == NULL) {
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   435
      // There was no eviction. Nothing to do.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   436
      return false;
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   437
    }
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   438
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   439
    start = _ct_bs->addr_for(card_ptr);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   440
    r = _g1->heap_region_containing(start);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   441
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   442
    // Checking whether the region we got back from the cache
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   443
    // is young here is inappropriate. The region could have been
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   444
    // freed, reallocated and tagged as young while in the cache.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   445
    // Hence we could see its young type change at any time.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   446
  }
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   447
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13516
diff changeset
   448
  // Don't use addr_for(card_ptr + 1) which can ask for
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13516
diff changeset
   449
  // a card beyond the heap.  This is not safe without a perm
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13516
diff changeset
   450
  // gen at the upper end of the heap.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13516
diff changeset
   451
  HeapWord* end   = start + CardTableModRefBS::card_size_in_words;
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   452
  MemRegion dirtyRegion(start, end);
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   453
28207
6ad23566cbef 8067655: Clean up G1 remembered set oop iteration
mgerdin
parents: 27905
diff changeset
   454
  G1ParPushHeapRSClosure* oops_in_heap_closure = NULL;
10995
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   455
  if (check_for_refs_into_cset) {
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   456
    // ConcurrentG1RefineThreads have worker numbers larger than what
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   457
    // _cset_rs_update_cl[] is set up to handle. But those threads should
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   458
    // only be active outside of a collection which means that when they
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   459
    // reach here they should have check_for_refs_into_cset == false.
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   460
    assert((size_t)worker_i < n_workers(), "index of worker larger than _cset_rs_update_cl[].length");
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   461
    oops_in_heap_closure = _cset_rs_update_cl[worker_i];
b3b2d17ff45d 7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents: 10770
diff changeset
   462
  }
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   463
  G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1,
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   464
                                                 _g1->g1_rem_set(),
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   465
                                                 oops_in_heap_closure,
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   466
                                                 check_for_refs_into_cset,
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   467
                                                 worker_i);
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   468
  update_rs_oop_cl.set_from(r);
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   469
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   470
  G1TriggerClosure trigger_cl;
35068
b0d5016aecc7 8144584: Change FilterIntoCSClosure to inherit OopClosure
sjohanss
parents: 35061
diff changeset
   471
  FilterIntoCSClosure into_cs_cl(_g1, &trigger_cl);
11586
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   472
  G1InvokeIfNotTriggeredClosure invoke_cl(&trigger_cl, &into_cs_cl);
ccc217c177ee 7133038: G1: Some small profile based optimizations
johnc
parents: 11396
diff changeset
   473
  G1Mux2Closure mux(&invoke_cl, &update_rs_oop_cl);
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   474
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   475
  FilterOutOfRegionClosure filter_then_update_rs_oop_cl(r,
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   476
                        (check_for_refs_into_cset ?
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   477
                                (OopClosure*)&mux :
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   478
                                (OopClosure*)&update_rs_oop_cl));
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   479
6068
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   480
  // The region for the current card may be a young region. The
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   481
  // current card may have been a card that was evicted from the
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   482
  // card cache. When the card was inserted into the cache, we had
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   483
  // determined that its region was non-young. While in the cache,
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   484
  // the region may have been freed during a cleanup pause, reallocated
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   485
  // and tagged as young.
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   486
  //
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   487
  // We wish to filter out cards for such a region but the current
9418
32a87dd6b746 7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents: 8683
diff changeset
   488
  // thread, if we're running concurrently, may "see" the young type
6068
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   489
  // change at any time (so an earlier "is_young" check may pass or
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   490
  // fail arbitrarily). We tell the iteration code to perform this
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   491
  // filtering when it has been determined that there has been an actual
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   492
  // allocation in this region and making it safe to check the young type.
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   493
  bool filter_young = true;
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   494
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   495
  HeapWord* stop_point =
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   496
    r->oops_on_card_seq_iterate_careful(dirtyRegion,
6068
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   497
                                        &filter_then_update_rs_oop_cl,
9418
32a87dd6b746 7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents: 8683
diff changeset
   498
                                        filter_young,
32a87dd6b746 7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents: 8683
diff changeset
   499
                                        card_ptr);
6068
80ef41e75a2d 6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents: 5891
diff changeset
   500
3590
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   501
  // If stop_point is non-null, then we encountered an unallocated region
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   502
  // (perhaps the unfilled portion of a TLAB.)  For now, we'll dirty the
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   503
  // card and re-enqueue: if we put off the card until a GC pause, then the
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   504
  // unallocated portion will be filled in.  Alternatively, we might try
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   505
  // the full complexity of the technique used in "regular" precleaning.
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   506
  if (stop_point != NULL) {
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   507
    // The card might have gotten re-dirtied and re-enqueued while we
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   508
    // worked.  (In fact, it's pretty likely.)
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   509
    if (*card_ptr != CardTableModRefBS::dirty_card_val()) {
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   510
      *card_ptr = CardTableModRefBS::dirty_card_val();
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   511
      MutexLockerEx x(Shared_DirtyCardQ_lock,
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   512
                      Mutex::_no_safepoint_check_flag);
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   513
      DirtyCardQueue* sdcq =
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   514
        JavaThread::dirty_card_queue_set().shared_dirty_card_queue();
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   515
      sdcq->enqueue(card_ptr);
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   516
    }
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   517
  } else {
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   518
    _conc_refine_cards++;
a268fa66d7fb 6819077: G1: first GC thread coming late into the GC.
johnc
parents: 3262
diff changeset
   519
  }
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   520
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   521
  // This gets set to true if the card being refined has
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   522
  // references that point into the collection set.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   523
  bool has_refs_into_cset = trigger_cl.triggered();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   524
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   525
  // We should only be detecting that the card contains references
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   526
  // that point into the collection set if the current thread is
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   527
  // a GC worker thread.
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   528
  assert(!has_refs_into_cset || SafepointSynchronize::is_at_safepoint(),
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   529
           "invalid result at non safepoint");
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   530
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   531
  return has_refs_into_cset;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   532
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   533
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   534
void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   535
  if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   536
      (period_count % G1SummarizeRSetStatsPeriod == 0)) {
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   537
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   538
    if (!_prev_period_summary.initialized()) {
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   539
      _prev_period_summary.initialize(this);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   540
    }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   541
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   542
    G1RemSetSummary current;
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   543
    current.initialize(this);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   544
    _prev_period_summary.subtract_from(&current);
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   545
37242
91e5f98fff6f 8152632: Rename LogHandle(...) to Log(...)
stefank
parents: 36374
diff changeset
   546
    Log(gc, remset) log;
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   547
    log.trace("%s", header);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   548
    ResourceMark rm;
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   549
    _prev_period_summary.print_on(log.trace_stream());
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   550
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   551
    _prev_period_summary.set(&current);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   552
  }
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
   553
}
2881
74a1337e4acc 6484957: G1: parallel concurrent refinement
iveresov
parents: 2741
diff changeset
   554
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
   555
void G1RemSet::print_summary_info() {
37242
91e5f98fff6f 8152632: Rename LogHandle(...) to Log(...)
stefank
parents: 36374
diff changeset
   556
  Log(gc, remset, exit) log;
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   557
  if (log.is_trace()) {
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   558
    log.trace(" Cumulative RS summary");
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   559
    G1RemSetSummary current;
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   560
    current.initialize(this);
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   561
    ResourceMark rm;
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 34246
diff changeset
   562
    current.print_on(log.trace_stream());
17854
d65bc1546091 8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents: 17327
diff changeset
   563
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   564
}
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   565
6958
cfa71cf3564d 6971296: G1: simplify G1RemSet class hierarchy
johnc
parents: 6759
diff changeset
   566
void G1RemSet::prepare_for_verify() {
2249
fb8abed44792 6817419: G1: Enable extensive verification for humongous regions
iveresov
parents: 2152
diff changeset
   567
  if (G1HRRSFlushLogBuffersOnVerify &&
fb8abed44792 6817419: G1: Enable extensive verification for humongous regions
iveresov
parents: 2152
diff changeset
   568
      (VerifyBeforeGC || VerifyAfterGC)
31331
a7c714b6cfb3 7097567: G1: abstract and encapsulate collector phases and transitions between them
drwhite
parents: 30764
diff changeset
   569
      &&  (!_g1->collector_state()->full_collection() || G1VerifyRSetsDuringFullGC)) {
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   570
    cleanupHRRS();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   571
    _g1->set_refine_cte_cl_concurrency(false);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   572
    if (SafepointSynchronize::is_at_safepoint()) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   573
      DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   574
      dcqs.concatenate_logs();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   575
    }
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   576
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   577
    G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache();
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   578
    bool use_hot_card_cache = hot_card_cache->use_cache();
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   579
    hot_card_cache->set_use_cache(false);
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   580
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   581
    DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set);
6247
00e5cc407d03 6814437: G1: remove the _new_refs array
johnc
parents: 6068
diff changeset
   582
    updateRS(&into_cset_dcq, 0);
33789
4a76a42bd42e 8141434: G1CollectedHeap::into_cset_dirty_card_queue_set should be moved to G1RemSet
david
parents: 33742
diff changeset
   583
    _into_cset_dirty_card_queue_set.clear();
2249
fb8abed44792 6817419: G1: Enable extensive verification for humongous regions
iveresov
parents: 2152
diff changeset
   584
17327
4bd0581aa231 7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents: 17108
diff changeset
   585
    hot_card_cache->set_use_cache(use_hot_card_cache);
2249
fb8abed44792 6817419: G1: Enable extensive verification for humongous regions
iveresov
parents: 2152
diff changeset
   586
    assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   587
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   588
}
37414
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   589
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   590
void G1RemSet::create_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   591
  _card_live_data.create(workers, mark_bitmap);
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   592
}
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   593
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   594
void G1RemSet::finalize_card_live_data(WorkGang* workers, G1CMBitMap* mark_bitmap) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   595
  _card_live_data.finalize(workers, mark_bitmap);
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   596
}
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   597
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   598
void G1RemSet::verify_card_live_data(WorkGang* workers, G1CMBitMap* bitmap) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   599
  _card_live_data.verify(workers, bitmap);
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   600
}
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   601
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   602
void G1RemSet::clear_card_live_data(WorkGang* workers) {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   603
  _card_live_data.clear(workers);
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   604
}
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   605
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   606
#ifdef ASSERT
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   607
void G1RemSet::verify_card_live_data_is_clear() {
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   608
  _card_live_data.verify_is_clear();
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   609
}
2672ba9af0dc 8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents: 37248
diff changeset
   610
#endif