author | brutisso |
Thu, 07 Aug 2014 09:35:08 +0200 | |
changeset 25909 | 571781915421 |
parent 24424 | 2658d7834c6e |
child 26160 | aba6b01cb988 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24106
diff
changeset
|
2 |
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
1374 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "gc_implementation/g1/concurrentG1Refine.hpp" |
|
27 |
#include "gc_implementation/g1/concurrentG1RefineThread.hpp" |
|
28 |
#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp" |
|
29 |
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
|
30 |
#include "gc_implementation/g1/g1CollectorPolicy.hpp" |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
31 |
#include "gc_implementation/g1/g1HotCardCache.hpp" |
13288
331d5b6725f3
7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
11586
diff
changeset
|
32 |
#include "gc_implementation/g1/g1GCPhaseTimes.hpp" |
7397 | 33 |
#include "gc_implementation/g1/g1OopClosures.inline.hpp" |
34 |
#include "gc_implementation/g1/g1RemSet.inline.hpp" |
|
35 |
#include "gc_implementation/g1/heapRegionSeq.inline.hpp" |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
36 |
#include "gc_implementation/g1/heapRegionRemSet.hpp" |
7397 | 37 |
#include "memory/iterator.hpp" |
38 |
#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
|
39 |
#include "utilities/globalDefinitions.hpp" |
7397 | 40 |
#include "utilities/intHisto.hpp" |
1374 | 41 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24106
diff
changeset
|
42 |
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24106
diff
changeset
|
43 |
|
1374 | 44 |
#define CARD_REPEAT_HISTO 0 |
45 |
||
46 |
#if CARD_REPEAT_HISTO |
|
47 |
static size_t ct_freq_sz; |
|
48 |
static jbyte* ct_freq = NULL; |
|
49 |
||
50 |
void init_ct_freq_table(size_t heap_sz_bytes) { |
|
51 |
if (ct_freq == NULL) { |
|
52 |
ct_freq_sz = heap_sz_bytes/CardTableModRefBS::card_size; |
|
53 |
ct_freq = new jbyte[ct_freq_sz]; |
|
54 |
for (size_t j = 0; j < ct_freq_sz; j++) ct_freq[j] = 0; |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
void ct_freq_note_card(size_t index) { |
|
59 |
assert(0 <= index && index < ct_freq_sz, "Bounds error."); |
|
60 |
if (ct_freq[index] < 100) { ct_freq[index]++; } |
|
61 |
} |
|
62 |
||
63 |
static IntHistogram card_repeat_count(10, 10); |
|
64 |
||
65 |
void ct_freq_update_histo_and_reset() { |
|
66 |
for (size_t j = 0; j < ct_freq_sz; j++) { |
|
67 |
card_repeat_count.add_entry(ct_freq[j]); |
|
68 |
ct_freq[j] = 0; |
|
69 |
} |
|
70 |
||
71 |
} |
|
72 |
#endif |
|
73 |
||
6958 | 74 |
G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) |
75 |
: _g1(g1), _conc_refine_cards(0), |
|
76 |
_ct_bs(ct_bs), _g1p(_g1->g1_policy()), |
|
1374 | 77 |
_cg1r(g1->concurrent_g1_refine()), |
6247 | 78 |
_cset_rs_update_cl(NULL), |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
79 |
_cards_scanned(NULL), _total_cards_scanned(0), |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
80 |
_prev_period_summary() |
1374 | 81 |
{ |
82 |
_seq_task = new SubTasksDone(NumSeqTasks); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
83 |
guarantee(n_workers() > 0, "There should be some workers"); |
13195 | 84 |
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC); |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
85 |
for (uint i = 0; i < n_workers(); i++) { |
6247 | 86 |
_cset_rs_update_cl[i] = NULL; |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
87 |
} |
20310
903b398490d9
8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
20309
diff
changeset
|
88 |
if (G1SummarizeRSetStats) { |
903b398490d9
8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
20309
diff
changeset
|
89 |
_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
|
90 |
} |
1374 | 91 |
} |
92 |
||
6958 | 93 |
G1RemSet::~G1RemSet() { |
1374 | 94 |
delete _seq_task; |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
95 |
for (uint i = 0; i < n_workers(); i++) { |
6247 | 96 |
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
|
97 |
} |
13195 | 98 |
FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC); |
1374 | 99 |
} |
100 |
||
101 |
void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { |
|
102 |
if (_g1->is_in_g1_reserved(mr.start())) { |
|
103 |
_n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); |
|
104 |
if (_start_first == NULL) _start_first = mr.start(); |
|
105 |
} |
|
106 |
} |
|
107 |
||
108 |
class ScanRSClosure : public HeapRegionClosure { |
|
109 |
size_t _cards_done, _cards; |
|
110 |
G1CollectedHeap* _g1h; |
|
19339 | 111 |
|
1374 | 112 |
OopsInHeapRegionClosure* _oc; |
19339 | 113 |
CodeBlobToOopClosure* _code_root_cl; |
114 |
||
1374 | 115 |
G1BlockOffsetSharedArray* _bot_shared; |
20309 | 116 |
G1SATBCardTableModRefBS *_ct_bs; |
19339 | 117 |
|
118 |
double _strong_code_root_scan_time_sec; |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
119 |
uint _worker_i; |
19339 | 120 |
int _block_size; |
121 |
bool _try_claimed; |
|
122 |
||
1374 | 123 |
public: |
19339 | 124 |
ScanRSClosure(OopsInHeapRegionClosure* oc, |
125 |
CodeBlobToOopClosure* code_root_cl, |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
126 |
uint worker_i) : |
1374 | 127 |
_oc(oc), |
19339 | 128 |
_code_root_cl(code_root_cl), |
129 |
_strong_code_root_scan_time_sec(0.0), |
|
1374 | 130 |
_cards(0), |
131 |
_cards_done(0), |
|
132 |
_worker_i(worker_i), |
|
133 |
_try_claimed(false) |
|
134 |
{ |
|
135 |
_g1h = G1CollectedHeap::heap(); |
|
136 |
_bot_shared = _g1h->bot_shared(); |
|
20309 | 137 |
_ct_bs = _g1h->g1_barrier_set(); |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
138 |
_block_size = MAX2<int>(G1RSetScanBlockSize, 1); |
1374 | 139 |
} |
140 |
||
141 |
void set_try_claimed() { _try_claimed = true; } |
|
142 |
||
143 |
void scanCard(size_t index, HeapRegion *r) { |
|
10770 | 144 |
// Stack allocate the DirtyCardToOopClosure instance |
145 |
HeapRegionDCTOC cl(_g1h, r, _oc, |
|
146 |
CardTableModRefBS::Precise, |
|
147 |
HeapRegionDCTOC::IntoCSFilterKind); |
|
1374 | 148 |
|
149 |
// Set the "from" region in the closure. |
|
150 |
_oc->set_region(r); |
|
151 |
HeapWord* card_start = _bot_shared->address_for_index(index); |
|
152 |
HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words; |
|
153 |
Space *sp = SharedHeap::heap()->space_containing(card_start); |
|
9418
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
154 |
MemRegion sm_region = sp->used_region_at_save_marks(); |
1374 | 155 |
MemRegion mr = sm_region.intersection(MemRegion(card_start,card_end)); |
9418
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
156 |
if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) { |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
157 |
// We make the card as "claimed" lazily (so races are possible |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
158 |
// but they're benign), which reduces the number of duplicate |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
159 |
// scans (the rsets of the regions in the cset can intersect). |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
160 |
_ct_bs->set_card_claimed(index); |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
161 |
_cards_done++; |
10770 | 162 |
cl.do_MemRegion(mr); |
1374 | 163 |
} |
164 |
} |
|
165 |
||
166 |
void printCard(HeapRegion* card_region, size_t card_index, |
|
167 |
HeapWord* card_start) { |
|
23858
dae377f5a7c7
8039244: Don't use UINT32_FORMAT and INT32_FORMAT when printing uints and ints in the GC code
stefank
parents:
23855
diff
changeset
|
168 |
gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") " |
24098
48f07e2c74de
8039957: Replace the last few %p usages with PTR_FORMAT in the GC code
stefank
parents:
23858
diff
changeset
|
169 |
"RS names card " SIZE_FORMAT_HEX ": " |
1374 | 170 |
"[" PTR_FORMAT ", " PTR_FORMAT ")", |
171 |
_worker_i, |
|
172 |
card_region->bottom(), card_region->end(), |
|
173 |
card_index, |
|
174 |
card_start, card_start + G1BlockOffsetSharedArray::N_words); |
|
175 |
} |
|
176 |
||
19339 | 177 |
void scan_strong_code_roots(HeapRegion* r) { |
178 |
double scan_start = os::elapsedTime(); |
|
179 |
r->strong_code_roots_do(_code_root_cl); |
|
180 |
_strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start); |
|
181 |
} |
|
182 |
||
1374 | 183 |
bool doHeapRegion(HeapRegion* r) { |
184 |
assert(r->in_collection_set(), "should only be called on elements of CS."); |
|
185 |
HeapRegionRemSet* hrrs = r->rem_set(); |
|
186 |
if (hrrs->iter_is_complete()) return false; // All done. |
|
187 |
if (!_try_claimed && !hrrs->claim_iter()) return false; |
|
9418
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
188 |
// If we ever free the collection set concurrently, we should also |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
189 |
// clear the card table concurrently therefore we won't need to |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
190 |
// add regions of the collection set to the dirty cards region. |
2883
406d1e6d1aa1
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
2881
diff
changeset
|
191 |
_g1h->push_dirty_cards_region(r); |
1374 | 192 |
// If we didn't return above, then |
193 |
// _try_claimed || r->claim_iter() |
|
194 |
// is true: either we're supposed to work on claimed-but-not-complete |
|
195 |
// regions, or we successfully claimed the region. |
|
19339 | 196 |
|
17108
cf72dcf9a8f2
8011724: G1: Stack allocate instances of HeapRegionRemSetIterator
johnc
parents:
13728
diff
changeset
|
197 |
HeapRegionRemSetIterator iter(hrrs); |
1374 | 198 |
size_t card_index; |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
199 |
|
22551 | 200 |
// We claim cards in block so as to reduce the contention. The block size is determined by |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
201 |
// the G1RSetScanBlockSize parameter. |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
202 |
size_t jump_to_card = hrrs->iter_claimed_next(_block_size); |
17108
cf72dcf9a8f2
8011724: G1: Stack allocate instances of HeapRegionRemSetIterator
johnc
parents:
13728
diff
changeset
|
203 |
for (size_t current_card = 0; iter.has_next(card_index); current_card++) { |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
204 |
if (current_card >= jump_to_card + _block_size) { |
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
205 |
jump_to_card = hrrs->iter_claimed_next(_block_size); |
2737 | 206 |
} |
4902
991aaddb5165
6923991: G1: improve scalability of RSet scanning
iveresov
parents:
3590
diff
changeset
|
207 |
if (current_card < jump_to_card) continue; |
1374 | 208 |
HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index); |
209 |
#if 0 |
|
210 |
gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", |
|
211 |
card_start, card_start + CardTableModRefBS::card_size_in_words); |
|
212 |
#endif |
|
213 |
||
214 |
HeapRegion* card_region = _g1h->heap_region_containing(card_start); |
|
215 |
_cards++; |
|
216 |
||
2883
406d1e6d1aa1
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
2881
diff
changeset
|
217 |
if (!card_region->is_on_dirty_cards_region_list()) { |
406d1e6d1aa1
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
2881
diff
changeset
|
218 |
_g1h->push_dirty_cards_region(card_region); |
406d1e6d1aa1
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
2881
diff
changeset
|
219 |
} |
406d1e6d1aa1
6819065: G1: eliminate high serial card table clearing time
apetrusenko
parents:
2881
diff
changeset
|
220 |
|
9418
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
221 |
// If the card is dirty, then we will scan it during updateRS. |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
222 |
if (!card_region->in_collection_set() && |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
223 |
!_ct_bs->is_card_dirty(card_index)) { |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
224 |
scanCard(card_index, card_region); |
1374 | 225 |
} |
226 |
} |
|
2737 | 227 |
if (!_try_claimed) { |
19339 | 228 |
// Scan the strong code root list attached to the current region |
229 |
scan_strong_code_roots(r); |
|
230 |
||
2737 | 231 |
hrrs->set_iter_complete(); |
232 |
} |
|
1374 | 233 |
return false; |
234 |
} |
|
19339 | 235 |
|
236 |
double strong_code_root_scan_time_sec() { |
|
237 |
return _strong_code_root_scan_time_sec; |
|
238 |
} |
|
239 |
||
1374 | 240 |
size_t cards_done() { return _cards_done;} |
241 |
size_t cards_looked_up() { return _cards;} |
|
242 |
}; |
|
243 |
||
19339 | 244 |
void G1RemSet::scanRS(OopsInHeapRegionClosure* oc, |
245 |
CodeBlobToOopClosure* code_root_cl, |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
246 |
uint worker_i) { |
1374 | 247 |
double rs_time_start = os::elapsedTime(); |
11176
9bb1ddd8da51
7112743: G1: Reduce overhead of marking closure during evacuation pauses
johnc
parents:
11174
diff
changeset
|
248 |
HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); |
1374 | 249 |
|
19339 | 250 |
ScanRSClosure scanRScl(oc, code_root_cl, worker_i); |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
251 |
|
1374 | 252 |
_g1->collection_set_iterate_from(startRegion, &scanRScl); |
253 |
scanRScl.set_try_claimed(); |
|
254 |
_g1->collection_set_iterate_from(startRegion, &scanRScl); |
|
255 |
||
19339 | 256 |
double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) |
257 |
- scanRScl.strong_code_root_scan_time_sec(); |
|
1374 | 258 |
|
19339 | 259 |
assert(_cards_scanned != NULL, "invariant"); |
1374 | 260 |
_cards_scanned[worker_i] = scanRScl.cards_done(); |
261 |
||
13288
331d5b6725f3
7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
11586
diff
changeset
|
262 |
_g1p->phase_times()->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0); |
19339 | 263 |
_g1p->phase_times()->record_strong_code_root_scan_time(worker_i, |
264 |
scanRScl.strong_code_root_scan_time_sec() * 1000.0); |
|
1374 | 265 |
} |
266 |
||
6247 | 267 |
// Closure used for updating RSets and recording references that |
268 |
// point into the collection set. Only called during an |
|
269 |
// evacuation pause. |
|
270 |
||
271 |
class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure { |
|
272 |
G1RemSet* _g1rs; |
|
273 |
DirtyCardQueue* _into_cset_dcq; |
|
274 |
public: |
|
275 |
RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h, |
|
276 |
DirtyCardQueue* into_cset_dcq) : |
|
277 |
_g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq) |
|
278 |
{} |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
279 |
bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
6247 | 280 |
// The only time we care about recording cards that |
281 |
// contain references that point into the collection set |
|
282 |
// is during RSet updating within an evacuation pause. |
|
283 |
// In this case worker_i should be the id of a GC worker thread. |
|
284 |
assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
285 |
assert(worker_i < (ParallelGCThreads == 0 ? 1 : ParallelGCThreads), "should be a GC worker"); |
1374 | 286 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
287 |
if (_g1rs->refine_card(card_ptr, worker_i, true)) { |
6247 | 288 |
// 'card_ptr' contains references that point into the collection |
289 |
// set. We need to record the card in the DCQS |
|
290 |
// (G1CollectedHeap::into_cset_dirty_card_queue_set()) |
|
291 |
// that's used for that purpose. |
|
292 |
// |
|
293 |
// Enqueue the card |
|
294 |
_into_cset_dcq->enqueue(card_ptr); |
|
295 |
} |
|
296 |
return true; |
|
297 |
} |
|
298 |
}; |
|
299 |
||
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
300 |
void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) { |
1374 | 301 |
double start = os::elapsedTime(); |
6247 | 302 |
// Apply the given closure to all remaining log entries. |
303 |
RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq); |
|
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
304 |
|
6247 | 305 |
_g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i); |
306 |
||
2881 | 307 |
// Now there should be no dirty cards. |
308 |
if (G1RSLogCheckCardTable) { |
|
309 |
CountNonCleanMemRegionClosure cl(_g1); |
|
310 |
_ct_bs->mod_card_iterate(&cl); |
|
311 |
// XXX This isn't true any more: keeping cards of young regions |
|
312 |
// marked dirty broke it. Need some reasonable fix. |
|
313 |
guarantee(cl.n() == 0, "Card table should be clean."); |
|
1374 | 314 |
} |
2881 | 315 |
|
13288
331d5b6725f3
7178361: G1: Make sure that PrintGC and PrintGCDetails use the same timing for the GC pause
brutisso
parents:
11586
diff
changeset
|
316 |
_g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0); |
1374 | 317 |
} |
318 |
||
6958 | 319 |
void G1RemSet::cleanupHRRS() { |
1374 | 320 |
HeapRegionRemSet::cleanup(); |
321 |
} |
|
322 |
||
6958 | 323 |
void G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, |
19339 | 324 |
CodeBlobToOopClosure* code_root_cl, |
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
325 |
uint worker_i) { |
1374 | 326 |
#if CARD_REPEAT_HISTO |
327 |
ct_freq_update_histo_and_reset(); |
|
328 |
#endif |
|
329 |
||
6247 | 330 |
// We cache the value of 'oc' closure into the appropriate slot in the |
331 |
// _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
|
332 |
assert(worker_i < n_workers(), "sanity"); |
6247 | 333 |
_cset_rs_update_cl[worker_i] = oc; |
334 |
||
335 |
// A DirtyCardQueue that is used to hold cards containing references |
|
336 |
// that point into the collection set. This DCQ is associated with a |
|
337 |
// special DirtyCardQueueSet (see g1CollectedHeap.hpp). Under normal |
|
338 |
// circumstances (i.e. the pause successfully completes), these cards |
|
339 |
// are just discarded (there's no need to update the RSets of regions |
|
340 |
// that were in the collection set - after the pause these regions |
|
341 |
// are wholly 'free' of live objects. In the event of an evacuation |
|
342 |
// failure the cards/buffers in this queue set are: |
|
343 |
// * passed to the DirtyCardQueueSet that is used to manage deferred |
|
344 |
// RSet updates, or |
|
345 |
// * scanned for references that point into the collection set |
|
346 |
// and the RSet of the corresponding region in the collection set |
|
347 |
// is updated immediately. |
|
348 |
DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set()); |
|
349 |
||
6250
5680f968c721
6930581: G1: assert(ParallelGCThreads > 1 || n_yielded() == _hrrs->occupied(),"Should have yielded all the ..
johnc
parents:
6247
diff
changeset
|
350 |
assert((ParallelGCThreads > 0) || worker_i == 0, "invariant"); |
5680f968c721
6930581: G1: assert(ParallelGCThreads > 1 || n_yielded() == _hrrs->occupied(),"Should have yielded all the ..
johnc
parents:
6247
diff
changeset
|
351 |
|
25909
571781915421
8051837: Remove temporary G1UseParallelRSetUpdating and G1UseParallelRSetScanning flags
brutisso
parents:
24424
diff
changeset
|
352 |
updateRS(&into_cset_dcq, worker_i); |
571781915421
8051837: Remove temporary G1UseParallelRSetUpdating and G1UseParallelRSetScanning flags
brutisso
parents:
24424
diff
changeset
|
353 |
scanRS(oc, code_root_cl, worker_i); |
6247 | 354 |
|
355 |
// We now clear the cached values of _cset_rs_update_cl for this worker |
|
356 |
_cset_rs_update_cl[worker_i] = NULL; |
|
1374 | 357 |
} |
358 |
||
6958 | 359 |
void G1RemSet::prepare_for_oops_into_collection_set_do() { |
1374 | 360 |
cleanupHRRS(); |
361 |
ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); |
|
362 |
_g1->set_refine_cte_cl_concurrency(false); |
|
363 |
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |
|
364 |
dcqs.concatenate_logs(); |
|
365 |
||
366 |
guarantee( _cards_scanned == NULL, "invariant" ); |
|
13195 | 367 |
_cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers(), mtGC); |
2009 | 368 |
for (uint i = 0; i < n_workers(); ++i) { |
369 |
_cards_scanned[i] = 0; |
|
370 |
} |
|
1374 | 371 |
_total_cards_scanned = 0; |
372 |
} |
|
373 |
||
374 |
||
6247 | 375 |
// This closure, applied to a DirtyCardQueueSet, is used to immediately |
376 |
// update the RSets for the regions in the CSet. For each card it iterates |
|
377 |
// through the oops which coincide with that card. It scans the reference |
|
378 |
// fields in each oop; when it finds an oop that points into the collection |
|
379 |
// set, the RSet for the region containing the referenced object is updated. |
|
380 |
class UpdateRSetCardTableEntryIntoCSetClosure: public CardTableEntryClosure { |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
381 |
G1CollectedHeap* _g1; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
382 |
CardTableModRefBS* _ct_bs; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
383 |
public: |
6247 | 384 |
UpdateRSetCardTableEntryIntoCSetClosure(G1CollectedHeap* g1, |
385 |
CardTableModRefBS* bs): |
|
386 |
_g1(g1), _ct_bs(bs) |
|
387 |
{ } |
|
388 |
||
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
389 |
bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
6247 | 390 |
// Construct the region representing the card. |
391 |
HeapWord* start = _ct_bs->addr_for(card_ptr); |
|
392 |
// And find the region containing it. |
|
393 |
HeapRegion* r = _g1->heap_region_containing(start); |
|
394 |
||
395 |
// Scan oops in the card looking for references into the collection set |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
396 |
// 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
|
397 |
// 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
|
398 |
// gen. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
399 |
HeapWord* end = start + CardTableModRefBS::card_size_in_words; |
6247 | 400 |
MemRegion scanRegion(start, end); |
401 |
||
402 |
UpdateRSetImmediate update_rs_cl(_g1->g1_rem_set()); |
|
10674
09e6f8d20337
7097053: G1: assert(da ? referent->is_oop() : referent->is_oop_or_null()) failed: referenceProcessor.cpp:1054
johnc
parents:
10670
diff
changeset
|
403 |
FilterIntoCSClosure update_rs_cset_oop_cl(NULL, _g1, &update_rs_cl); |
6247 | 404 |
FilterOutOfRegionClosure filter_then_update_rs_cset_oop_cl(r, &update_rs_cset_oop_cl); |
405 |
||
406 |
// We can pass false as the "filter_young" parameter here as: |
|
407 |
// * we should be in a STW pause, |
|
408 |
// * the DCQS to which this closure is applied is used to hold |
|
409 |
// references that point into the collection set from the prior |
|
410 |
// RSet updating, |
|
411 |
// * the post-write barrier shouldn't be logging updates to young |
|
412 |
// regions (but there is a situation where this can happen - see |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
413 |
// the comment in G1RemSet::refine_card() below - |
6247 | 414 |
// that should not be applicable here), and |
415 |
// * during actual RSet updating, the filtering of cards in young |
|
416 |
// regions in HeapRegion::oops_on_card_seq_iterate_careful is |
|
417 |
// employed. |
|
418 |
// As a result, when this closure is applied to "refs into cset" |
|
419 |
// DCQS, we shouldn't see any cards in young regions. |
|
420 |
update_rs_cl.set_region(r); |
|
421 |
HeapWord* stop_point = |
|
422 |
r->oops_on_card_seq_iterate_careful(scanRegion, |
|
9418
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
423 |
&filter_then_update_rs_cset_oop_cl, |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
424 |
false /* filter_young */, |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
425 |
NULL /* card_ptr */); |
6247 | 426 |
|
427 |
// Since this is performed in the event of an evacuation failure, we |
|
428 |
// we shouldn't see a non-null stop point |
|
429 |
assert(stop_point == NULL, "saw an unallocated region"); |
|
430 |
return true; |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
431 |
} |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
432 |
}; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
433 |
|
6958 | 434 |
void G1RemSet::cleanup_after_oops_into_collection_set_do() { |
1374 | 435 |
guarantee( _cards_scanned != NULL, "invariant" ); |
436 |
_total_cards_scanned = 0; |
|
10000
5bbb58b0dbb9
7046182: G1: remove unnecessary iterations over the collection set
tonyp
parents:
9988
diff
changeset
|
437 |
for (uint i = 0; i < n_workers(); ++i) { |
1374 | 438 |
_total_cards_scanned += _cards_scanned[i]; |
10000
5bbb58b0dbb9
7046182: G1: remove unnecessary iterations over the collection set
tonyp
parents:
9988
diff
changeset
|
439 |
} |
13195 | 440 |
FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC); |
1374 | 441 |
_cards_scanned = NULL; |
442 |
// Cleanup after copy |
|
443 |
_g1->set_refine_cte_cl_concurrency(true); |
|
444 |
// Set all cards back to clean. |
|
445 |
_g1->cleanUpCardTable(); |
|
2881 | 446 |
|
6247 | 447 |
DirtyCardQueueSet& into_cset_dcqs = _g1->into_cset_dirty_card_queue_set(); |
448 |
int into_cset_n_buffers = into_cset_dcqs.completed_buffers_num(); |
|
449 |
||
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
450 |
if (_g1->evacuation_failed()) { |
23455
e541bff96524
8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents:
22772
diff
changeset
|
451 |
double restore_remembered_set_start = os::elapsedTime(); |
e541bff96524
8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents:
22772
diff
changeset
|
452 |
|
6247 | 453 |
// Restore remembered sets for the regions pointing into the collection set. |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
454 |
if (G1DeferredRSUpdate) { |
6247 | 455 |
// If deferred RS updates are enabled then we just need to transfer |
456 |
// the completed buffers from (a) the DirtyCardQueueSet used to hold |
|
457 |
// cards that contain references that point into the collection set |
|
458 |
// to (b) the DCQS used to hold the deferred RS updates |
|
459 |
_g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
460 |
} else { |
6247 | 461 |
|
462 |
CardTableModRefBS* bs = (CardTableModRefBS*)_g1->barrier_set(); |
|
463 |
UpdateRSetCardTableEntryIntoCSetClosure update_rs_cset_immediate(_g1, bs); |
|
464 |
||
465 |
int n_completed_buffers = 0; |
|
466 |
while (into_cset_dcqs.apply_closure_to_completed_buffer(&update_rs_cset_immediate, |
|
467 |
0, 0, true)) { |
|
468 |
n_completed_buffers++; |
|
469 |
} |
|
470 |
assert(n_completed_buffers == into_cset_n_buffers, "missed some buffers"); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
471 |
} |
23455
e541bff96524
8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents:
22772
diff
changeset
|
472 |
|
e541bff96524
8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents:
22772
diff
changeset
|
473 |
_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
|
474 |
} |
6247 | 475 |
|
476 |
// Free any completed buffers in the DirtyCardQueueSet used to hold cards |
|
477 |
// which contain references that point into the collection. |
|
478 |
_g1->into_cset_dirty_card_queue_set().clear(); |
|
479 |
assert(_g1->into_cset_dirty_card_queue_set().completed_buffers_num() == 0, |
|
480 |
"all buffers should be freed"); |
|
481 |
_g1->into_cset_dirty_card_queue_set().clear_n_completed_buffers(); |
|
1374 | 482 |
} |
483 |
||
484 |
class ScrubRSClosure: public HeapRegionClosure { |
|
485 |
G1CollectedHeap* _g1h; |
|
486 |
BitMap* _region_bm; |
|
487 |
BitMap* _card_bm; |
|
488 |
CardTableModRefBS* _ctbs; |
|
489 |
public: |
|
490 |
ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) : |
|
491 |
_g1h(G1CollectedHeap::heap()), |
|
492 |
_region_bm(region_bm), _card_bm(card_bm), |
|
20309 | 493 |
_ctbs(_g1h->g1_barrier_set()) {} |
1374 | 494 |
|
495 |
bool doHeapRegion(HeapRegion* r) { |
|
496 |
if (!r->continuesHumongous()) { |
|
497 |
r->rem_set()->scrub(_ctbs, _region_bm, _card_bm); |
|
498 |
} |
|
499 |
return false; |
|
500 |
} |
|
501 |
}; |
|
502 |
||
6958 | 503 |
void G1RemSet::scrub(BitMap* region_bm, BitMap* card_bm) { |
1374 | 504 |
ScrubRSClosure scrub_cl(region_bm, card_bm); |
505 |
_g1->heap_region_iterate(&scrub_cl); |
|
506 |
} |
|
507 |
||
6958 | 508 |
void G1RemSet::scrub_par(BitMap* region_bm, BitMap* card_bm, |
11396
917d8673b5ef
7121618: Change type of number of GC workers to unsigned int.
jmasa
parents:
11176
diff
changeset
|
509 |
uint worker_num, int claim_val) { |
1374 | 510 |
ScrubRSClosure scrub_cl(region_bm, card_bm); |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
11169
diff
changeset
|
511 |
_g1->heap_region_par_iterate_chunked(&scrub_cl, |
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
11169
diff
changeset
|
512 |
worker_num, |
11396
917d8673b5ef
7121618: Change type of number of GC workers to unsigned int.
jmasa
parents:
11176
diff
changeset
|
513 |
n_workers(), |
11174
fccee5238e70
6593758: RFE: Enhance GC ergonomics to dynamically choose ParallelGCThreads
jmasa
parents:
11169
diff
changeset
|
514 |
claim_val); |
1374 | 515 |
} |
516 |
||
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
517 |
G1TriggerClosure::G1TriggerClosure() : |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
518 |
_triggered(false) { } |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
519 |
|
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
520 |
G1InvokeIfNotTriggeredClosure::G1InvokeIfNotTriggeredClosure(G1TriggerClosure* t_cl, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
521 |
OopClosure* oop_cl) : |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
522 |
_trigger_cl(t_cl), _oop_cl(oop_cl) { } |
6247 | 523 |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
524 |
G1Mux2Closure::G1Mux2Closure(OopClosure *c1, OopClosure *c2) : |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
525 |
_c1(c1), _c2(c2) { } |
6247 | 526 |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
527 |
G1UpdateRSOrPushRefOopClosure:: |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
528 |
G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
529 |
G1RemSet* rs, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
530 |
OopsInHeapRegionClosure* push_ref_cl, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
531 |
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
|
532 |
uint worker_i) : |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
533 |
_g1(g1h), _g1_rem_set(rs), _from(NULL), |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
534 |
_record_refs_into_cset(record_refs_into_cset), |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
535 |
_push_ref_cl(push_ref_cl), _worker_i(worker_i) { } |
6247 | 536 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
537 |
// 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
|
538 |
// 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
|
539 |
// false otherwise. |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
540 |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
541 |
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
|
542 |
bool check_for_refs_into_cset) { |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
543 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
544 |
// 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
|
545 |
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
|
546 |
// 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
|
547 |
// into the collection set. |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
548 |
return false; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
549 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
550 |
|
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
551 |
// Construct the region representing the card. |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
552 |
HeapWord* start = _ct_bs->addr_for(card_ptr); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
553 |
// And find the region containing it. |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
554 |
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
|
555 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
556 |
// 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
|
557 |
// 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
|
558 |
// 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
|
559 |
// 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
|
560 |
// 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
|
561 |
// 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
|
562 |
// 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
|
563 |
// 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
|
564 |
// 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
|
565 |
// 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
|
566 |
// 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
|
567 |
if (r->is_young()) { |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
568 |
return false; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
569 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
570 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
571 |
// 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
|
572 |
// actually don't want to scan any cards on the collection set, |
22551 | 573 |
// 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
|
574 |
// 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
|
575 |
// 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
|
576 |
// 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
|
577 |
// 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
|
578 |
// 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
|
579 |
// 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
|
580 |
// 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
|
581 |
if (r->in_collection_set()) { |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
582 |
return false; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
583 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
584 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
585 |
// 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
|
586 |
// * pointer to the current card |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
587 |
// (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
|
588 |
// * null |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
589 |
// (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
|
590 |
// which had some headroom), |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
591 |
// * 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
|
592 |
// |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
593 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
594 |
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
|
595 |
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
|
596 |
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
|
597 |
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
|
598 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
599 |
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
|
600 |
if (card_ptr == NULL) { |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
601 |
// 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
|
602 |
return false; |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
603 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
604 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
605 |
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
|
606 |
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
|
607 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
608 |
// 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
|
609 |
// 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
|
610 |
// 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
|
611 |
// 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
|
612 |
} |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
613 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
614 |
// 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
|
615 |
// 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
|
616 |
// gen at the upper end of the heap. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
617 |
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
|
618 |
MemRegion dirtyRegion(start, end); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
619 |
|
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
620 |
#if CARD_REPEAT_HISTO |
8103
65eafe3fb3c7
6923430: G1: assert(res != 0,"This should have worked.")
johnc
parents:
7397
diff
changeset
|
621 |
init_ct_freq_table(_g1->max_capacity()); |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
622 |
ct_freq_note_card(_ct_bs->index_for(start)); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
623 |
#endif |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
624 |
|
10995
b3b2d17ff45d
7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents:
10770
diff
changeset
|
625 |
OopsInHeapRegionClosure* oops_in_heap_closure = NULL; |
b3b2d17ff45d
7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents:
10770
diff
changeset
|
626 |
if (check_for_refs_into_cset) { |
b3b2d17ff45d
7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents:
10770
diff
changeset
|
627 |
// ConcurrentG1RefineThreads have worker numbers larger than what |
b3b2d17ff45d
7106751: G1: gc/gctests/nativeGC03 crashes VM with SIGSEGV
brutisso
parents:
10770
diff
changeset
|
628 |
// _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
|
629 |
// 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
|
630 |
// 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
|
631 |
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
|
632 |
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
|
633 |
} |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
634 |
G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
635 |
_g1->g1_rem_set(), |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
636 |
oops_in_heap_closure, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
637 |
check_for_refs_into_cset, |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
638 |
worker_i); |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
639 |
update_rs_oop_cl.set_from(r); |
6247 | 640 |
|
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
641 |
G1TriggerClosure trigger_cl; |
10674
09e6f8d20337
7097053: G1: assert(da ? referent->is_oop() : referent->is_oop_or_null()) failed: referenceProcessor.cpp:1054
johnc
parents:
10670
diff
changeset
|
642 |
FilterIntoCSClosure into_cs_cl(NULL, _g1, &trigger_cl); |
11586
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
643 |
G1InvokeIfNotTriggeredClosure invoke_cl(&trigger_cl, &into_cs_cl); |
ccc217c177ee
7133038: G1: Some small profile based optimizations
johnc
parents:
11396
diff
changeset
|
644 |
G1Mux2Closure mux(&invoke_cl, &update_rs_oop_cl); |
6247 | 645 |
|
646 |
FilterOutOfRegionClosure filter_then_update_rs_oop_cl(r, |
|
647 |
(check_for_refs_into_cset ? |
|
648 |
(OopClosure*)&mux : |
|
649 |
(OopClosure*)&update_rs_oop_cl)); |
|
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
650 |
|
6068
80ef41e75a2d
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
5891
diff
changeset
|
651 |
// 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
|
652 |
// 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
|
653 |
// 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
|
654 |
// 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
|
655 |
// 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
|
656 |
// and tagged as young. |
80ef41e75a2d
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
5891
diff
changeset
|
657 |
// |
80ef41e75a2d
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
5891
diff
changeset
|
658 |
// 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
|
659 |
// 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
|
660 |
// 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
|
661 |
// 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
|
662 |
// 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
|
663 |
// 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
|
664 |
bool filter_young = true; |
80ef41e75a2d
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
5891
diff
changeset
|
665 |
|
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
666 |
HeapWord* stop_point = |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
667 |
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
|
668 |
&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
|
669 |
filter_young, |
32a87dd6b746
7035144: G1: nightly failure: Non-dirty cards in region that should be dirty (failures still exist...)
tonyp
parents:
8683
diff
changeset
|
670 |
card_ptr); |
6068
80ef41e75a2d
6956639: G1: assert(cached_ptr != card_ptr) failed: shouldn't be, concurrentG1Refine.cpp:307
johnc
parents:
5891
diff
changeset
|
671 |
|
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
672 |
// 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
|
673 |
// (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
|
674 |
// 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
|
675 |
// 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
|
676 |
// 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
|
677 |
if (stop_point != NULL) { |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
678 |
// 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
|
679 |
// worked. (In fact, it's pretty likely.) |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
680 |
if (*card_ptr != CardTableModRefBS::dirty_card_val()) { |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
681 |
*card_ptr = CardTableModRefBS::dirty_card_val(); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
682 |
MutexLockerEx x(Shared_DirtyCardQ_lock, |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
683 |
Mutex::_no_safepoint_check_flag); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
684 |
DirtyCardQueue* sdcq = |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
685 |
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
|
686 |
sdcq->enqueue(card_ptr); |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
687 |
} |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
688 |
} else { |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
689 |
_conc_refine_cards++; |
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
690 |
} |
6247 | 691 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
692 |
// 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
|
693 |
// 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
|
694 |
bool has_refs_into_cset = trigger_cl.triggered(); |
1374 | 695 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
696 |
// 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
|
697 |
// 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
|
698 |
// a GC worker thread. |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
699 |
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
|
700 |
"invalid result at non safepoint"); |
6247 | 701 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
702 |
return has_refs_into_cset; |
1374 | 703 |
} |
704 |
||
20305
af013cf4a5e6
8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents:
19339
diff
changeset
|
705 |
void G1RemSet::print_periodic_summary_info(const char* header) { |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
706 |
G1RemSetSummary current; |
20310
903b398490d9
8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
20309
diff
changeset
|
707 |
current.initialize(this); |
1374 | 708 |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
709 |
_prev_period_summary.subtract_from(¤t); |
20305
af013cf4a5e6
8014078: G1: improve remembered set summary information by providing per region type information
tschatzl
parents:
19339
diff
changeset
|
710 |
print_summary_info(&_prev_period_summary, header); |
1374 | 711 |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
712 |
_prev_period_summary.set(¤t); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
713 |
} |
2881 | 714 |
|
6958 | 715 |
void G1RemSet::print_summary_info() { |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
716 |
G1RemSetSummary current; |
20310
903b398490d9
8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
20309
diff
changeset
|
717 |
current.initialize(this); |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
718 |
|
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
719 |
print_summary_info(¤t, " Cumulative RS summary"); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
720 |
} |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
721 |
|
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
722 |
void G1RemSet::print_summary_info(G1RemSetSummary * summary, const char * header) { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
723 |
assert(summary != NULL, "just checking"); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
724 |
|
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
725 |
if (header != NULL) { |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
726 |
gclog_or_tty->print_cr("%s", header); |
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
727 |
} |
1374 | 728 |
|
729 |
#if CARD_REPEAT_HISTO |
|
730 |
gclog_or_tty->print_cr("\nG1 card_repeat count histogram: "); |
|
731 |
gclog_or_tty->print_cr(" # of repeats --> # of cards with that number."); |
|
732 |
card_repeat_count.print_on(gclog_or_tty); |
|
733 |
#endif |
|
734 |
||
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
735 |
summary->print_on(gclog_or_tty); |
1374 | 736 |
} |
6247 | 737 |
|
6958 | 738 |
void G1RemSet::prepare_for_verify() { |
2249
fb8abed44792
6817419: G1: Enable extensive verification for humongous regions
iveresov
parents:
2152
diff
changeset
|
739 |
if (G1HRRSFlushLogBuffersOnVerify && |
fb8abed44792
6817419: G1: Enable extensive verification for humongous regions
iveresov
parents:
2152
diff
changeset
|
740 |
(VerifyBeforeGC || VerifyAfterGC) |
17855
9d0719d7bb85
8015244: G1: Verification after a full GC is incorrectly placed.
johnc
parents:
17854
diff
changeset
|
741 |
&& (!_g1->full_collection() || G1VerifyRSetsDuringFullGC)) { |
1374 | 742 |
cleanupHRRS(); |
743 |
_g1->set_refine_cte_cl_concurrency(false); |
|
744 |
if (SafepointSynchronize::is_at_safepoint()) { |
|
745 |
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |
|
746 |
dcqs.concatenate_logs(); |
|
747 |
} |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
748 |
|
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
749 |
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
|
750 |
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
|
751 |
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
|
752 |
|
6247 | 753 |
DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set()); |
754 |
updateRS(&into_cset_dcq, 0); |
|
755 |
_g1->into_cset_dirty_card_queue_set().clear(); |
|
2249
fb8abed44792
6817419: G1: Enable extensive verification for humongous regions
iveresov
parents:
2152
diff
changeset
|
756 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
757 |
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
|
758 |
assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed"); |
1374 | 759 |
} |
760 |
} |