author | tschatzl |
Fri, 09 Feb 2018 12:53:08 +0100 | |
changeset 48890 | f9884e190f2b |
parent 48889 | 216c2aabbf1f |
child 48969 | 7eb296a8ce2c |
child 49071 | 663f20fc5109 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
46307
686d50172bfd
8071278: Fix the closure mess in G1RemSet::refine_card()
tschatzl
parents:
42589
diff
changeset
|
2 |
* Copyright (c) 2001, 2017, 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" |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
26 |
#include "gc/g1/dirtyCardQueue.hpp" |
30764 | 27 |
#include "gc/g1/g1BlockOffsetTable.inline.hpp" |
28 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
|
47789
a77a7d3bc4f6
8149127: Rename g1/concurrentMarkThread.* to g1/g1ConcurrentMarkThread.*
tschatzl
parents:
47647
diff
changeset
|
29 |
#include "gc/g1/g1ConcurrentRefine.hpp" |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
30 |
#include "gc/g1/g1FromCardCache.hpp" |
30764 | 31 |
#include "gc/g1/g1GCPhaseTimes.hpp" |
32 |
#include "gc/g1/g1HotCardCache.hpp" |
|
33 |
#include "gc/g1/g1OopClosures.inline.hpp" |
|
47885
5caa1d5f74c1
8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
47789
diff
changeset
|
34 |
#include "gc/g1/g1RemSet.hpp" |
35862
411842d0c882
8146395: Add inline qualifier in oop.hpp and fix inlining in gc files
goetz
parents:
35469
diff
changeset
|
35 |
#include "gc/g1/g1SATBCardTableModRefBS.inline.hpp" |
35198
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
36 |
#include "gc/g1/heapRegion.inline.hpp" |
30764 | 37 |
#include "gc/g1/heapRegionManager.inline.hpp" |
38 |
#include "gc/g1/heapRegionRemSet.hpp" |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
39 |
#include "gc/shared/gcTraceTime.inline.hpp" |
47647
64dba69fc528
8189276: Make SuspendibleThreadSet and related code available to other GCs
rkennke
parents:
47216
diff
changeset
|
40 |
#include "gc/shared/suspendibleThreadSet.hpp" |
7397 | 41 |
#include "memory/iterator.hpp" |
37248 | 42 |
#include "memory/resourceArea.hpp" |
7397 | 43 |
#include "oops/oop.inline.hpp" |
46625 | 44 |
#include "utilities/align.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 | 46 |
#include "utilities/intHisto.hpp" |
30175 | 47 |
#include "utilities/stack.inline.hpp" |
1374 | 48 |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
49 |
// Collects information about the overall remembered set scan progress during an evacuation. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
50 |
class G1RemSetScanState : public CHeapObj<mtGC> { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
51 |
private: |
38154 | 52 |
class G1ClearCardTableTask : public AbstractGangTask { |
53 |
G1CollectedHeap* _g1h; |
|
54 |
uint* _dirty_region_list; |
|
55 |
size_t _num_dirty_regions; |
|
56 |
size_t _chunk_length; |
|
57 |
||
58 |
size_t volatile _cur_dirty_regions; |
|
59 |
public: |
|
60 |
G1ClearCardTableTask(G1CollectedHeap* g1h, |
|
61 |
uint* dirty_region_list, |
|
62 |
size_t num_dirty_regions, |
|
63 |
size_t chunk_length) : |
|
64 |
AbstractGangTask("G1 Clear Card Table Task"), |
|
65 |
_g1h(g1h), |
|
66 |
_dirty_region_list(dirty_region_list), |
|
67 |
_num_dirty_regions(num_dirty_regions), |
|
68 |
_chunk_length(chunk_length), |
|
69 |
_cur_dirty_regions(0) { |
|
70 |
||
71 |
assert(chunk_length > 0, "must be"); |
|
72 |
} |
|
73 |
||
74 |
static size_t chunk_size() { return M; } |
|
75 |
||
76 |
void work(uint worker_id) { |
|
77 |
G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set(); |
|
78 |
||
79 |
while (_cur_dirty_regions < _num_dirty_regions) { |
|
80 |
size_t next = Atomic::add(_chunk_length, &_cur_dirty_regions) - _chunk_length; |
|
81 |
size_t max = MIN2(next + _chunk_length, _num_dirty_regions); |
|
82 |
||
83 |
for (size_t i = next; i < max; i++) { |
|
84 |
HeapRegion* r = _g1h->region_at(_dirty_region_list[i]); |
|
85 |
if (!r->is_survivor()) { |
|
86 |
ct_bs->clear(MemRegion(r->bottom(), r->end())); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
} |
|
91 |
}; |
|
92 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
93 |
size_t _max_regions; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
94 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
95 |
// Scan progress for the remembered set of a single region. Transitions from |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
96 |
// Unclaimed -> Claimed -> Complete. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
97 |
// At each of the transitions the thread that does the transition needs to perform |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
98 |
// some special action once. This is the reason for the extra "Claimed" state. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
99 |
typedef jint G1RemsetIterState; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
100 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
101 |
static const G1RemsetIterState Unclaimed = 0; // The remembered set has not been scanned yet. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
102 |
static const G1RemsetIterState Claimed = 1; // The remembered set is currently being scanned. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
103 |
static const G1RemsetIterState Complete = 2; // The remembered set has been completely scanned. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
104 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
105 |
G1RemsetIterState volatile* _iter_states; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
106 |
// The current location where the next thread should continue scanning in a region's |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
107 |
// remembered set. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
108 |
size_t volatile* _iter_claims; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
109 |
|
38154 | 110 |
// Temporary buffer holding the regions we used to store remembered set scan duplicate |
111 |
// information. These are also called "dirty". Valid entries are from [0.._cur_dirty_region) |
|
112 |
uint* _dirty_region_buffer; |
|
113 |
||
114 |
typedef jbyte IsDirtyRegionState; |
|
115 |
static const IsDirtyRegionState Clean = 0; |
|
116 |
static const IsDirtyRegionState Dirty = 1; |
|
117 |
// Holds a flag for every region whether it is in the _dirty_region_buffer already |
|
118 |
// to avoid duplicates. Uses jbyte since there are no atomic instructions for bools. |
|
119 |
IsDirtyRegionState* _in_dirty_region_buffer; |
|
120 |
size_t _cur_dirty_region; |
|
46520 | 121 |
|
122 |
// Creates a snapshot of the current _top values at the start of collection to |
|
123 |
// filter out card marks that we do not want to scan. |
|
124 |
class G1ResetScanTopClosure : public HeapRegionClosure { |
|
125 |
private: |
|
126 |
HeapWord** _scan_top; |
|
127 |
public: |
|
128 |
G1ResetScanTopClosure(HeapWord** scan_top) : _scan_top(scan_top) { } |
|
129 |
||
48890
f9884e190f2b
8197493: [Backout] JDK-8196602 Change HeapRegionClosure to comply to naming conventions
tschatzl
parents:
48889
diff
changeset
|
130 |
virtual bool doHeapRegion(HeapRegion* r) { |
46520 | 131 |
uint hrm_index = r->hrm_index(); |
132 |
if (!r->in_collection_set() && r->is_old_or_humongous()) { |
|
133 |
_scan_top[hrm_index] = r->top(); |
|
134 |
} else { |
|
135 |
_scan_top[hrm_index] = r->bottom(); |
|
136 |
} |
|
137 |
return false; |
|
138 |
} |
|
139 |
}; |
|
140 |
||
141 |
// For each region, contains the maximum top() value to be used during this garbage |
|
142 |
// collection. Subsumes common checks like filtering out everything but old and |
|
143 |
// humongous regions outside the collection set. |
|
144 |
// This is valid because we are not interested in scanning stray remembered set |
|
145 |
// entries from free or archive regions. |
|
146 |
HeapWord** _scan_top; |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
147 |
public: |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
148 |
G1RemSetScanState() : |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
149 |
_max_regions(0), |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
150 |
_iter_states(NULL), |
38154 | 151 |
_iter_claims(NULL), |
152 |
_dirty_region_buffer(NULL), |
|
153 |
_in_dirty_region_buffer(NULL), |
|
46520 | 154 |
_cur_dirty_region(0), |
155 |
_scan_top(NULL) { |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
156 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
157 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
158 |
~G1RemSetScanState() { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
159 |
if (_iter_states != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
160 |
FREE_C_HEAP_ARRAY(G1RemsetIterState, _iter_states); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
161 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
162 |
if (_iter_claims != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
163 |
FREE_C_HEAP_ARRAY(size_t, _iter_claims); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
164 |
} |
38154 | 165 |
if (_dirty_region_buffer != NULL) { |
166 |
FREE_C_HEAP_ARRAY(uint, _dirty_region_buffer); |
|
167 |
} |
|
168 |
if (_in_dirty_region_buffer != NULL) { |
|
169 |
FREE_C_HEAP_ARRAY(IsDirtyRegionState, _in_dirty_region_buffer); |
|
170 |
} |
|
46520 | 171 |
if (_scan_top != NULL) { |
172 |
FREE_C_HEAP_ARRAY(HeapWord*, _scan_top); |
|
173 |
} |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
174 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
175 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
176 |
void initialize(uint max_regions) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
177 |
assert(_iter_states == NULL, "Must not be initialized twice"); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
178 |
assert(_iter_claims == NULL, "Must not be initialized twice"); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
179 |
_max_regions = max_regions; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
180 |
_iter_states = NEW_C_HEAP_ARRAY(G1RemsetIterState, max_regions, mtGC); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
181 |
_iter_claims = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC); |
38154 | 182 |
_dirty_region_buffer = NEW_C_HEAP_ARRAY(uint, max_regions, mtGC); |
183 |
_in_dirty_region_buffer = NEW_C_HEAP_ARRAY(IsDirtyRegionState, max_regions, mtGC); |
|
46520 | 184 |
_scan_top = NEW_C_HEAP_ARRAY(HeapWord*, max_regions, mtGC); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
185 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
186 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
187 |
void reset() { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
188 |
for (uint i = 0; i < _max_regions; i++) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
189 |
_iter_states[i] = Unclaimed; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
190 |
} |
46520 | 191 |
|
192 |
G1ResetScanTopClosure cl(_scan_top); |
|
193 |
G1CollectedHeap::heap()->heap_region_iterate(&cl); |
|
194 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
195 |
memset((void*)_iter_claims, 0, _max_regions * sizeof(size_t)); |
38154 | 196 |
memset(_in_dirty_region_buffer, Clean, _max_regions * sizeof(IsDirtyRegionState)); |
197 |
_cur_dirty_region = 0; |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
198 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
199 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
200 |
// Attempt to claim the remembered set of the region for iteration. Returns true |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
201 |
// if this call caused the transition from Unclaimed to Claimed. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
202 |
inline bool claim_iter(uint region) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
203 |
assert(region < _max_regions, "Tried to access invalid region %u", region); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
204 |
if (_iter_states[region] != Unclaimed) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
205 |
return false; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
206 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
207 |
jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_states[region]), Unclaimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
208 |
return (res == Unclaimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
209 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
210 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
211 |
// Try to atomically sets the iteration state to "complete". Returns true for the |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
212 |
// thread that caused the transition. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
213 |
inline bool set_iter_complete(uint region) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
214 |
if (iter_is_complete(region)) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
215 |
return false; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
216 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
217 |
jint res = Atomic::cmpxchg(Complete, (jint*)(&_iter_states[region]), Claimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
218 |
return (res == Claimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
219 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
220 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
221 |
// Returns true if the region's iteration is complete. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
222 |
inline bool iter_is_complete(uint region) const { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
223 |
assert(region < _max_regions, "Tried to access invalid region %u", region); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
224 |
return _iter_states[region] == Complete; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
225 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
226 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
227 |
// The current position within the remembered set of the given region. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
228 |
inline size_t iter_claimed(uint region) const { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
229 |
assert(region < _max_regions, "Tried to access invalid region %u", region); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
230 |
return _iter_claims[region]; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
231 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
232 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
233 |
// Claim the next block of cards within the remembered set of the region with |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
234 |
// step size. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
235 |
inline size_t iter_claimed_next(uint region, size_t step) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
236 |
return Atomic::add(step, &_iter_claims[region]) - step; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
237 |
} |
38154 | 238 |
|
239 |
void add_dirty_region(uint region) { |
|
240 |
if (_in_dirty_region_buffer[region] == Dirty) { |
|
241 |
return; |
|
242 |
} |
|
243 |
||
244 |
bool marked_as_dirty = Atomic::cmpxchg(Dirty, &_in_dirty_region_buffer[region], Clean) == Clean; |
|
245 |
if (marked_as_dirty) { |
|
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46778
diff
changeset
|
246 |
size_t allocated = Atomic::add(1u, &_cur_dirty_region) - 1; |
38154 | 247 |
_dirty_region_buffer[allocated] = region; |
248 |
} |
|
249 |
} |
|
250 |
||
46520 | 251 |
HeapWord* scan_top(uint region_idx) const { |
252 |
return _scan_top[region_idx]; |
|
253 |
} |
|
254 |
||
38154 | 255 |
// Clear the card table of "dirty" regions. |
256 |
void clear_card_table(WorkGang* workers) { |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
257 |
if (_cur_dirty_region == 0) { |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
258 |
return; |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
259 |
} |
38154 | 260 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46614
diff
changeset
|
261 |
size_t const num_chunks = align_up(_cur_dirty_region * HeapRegion::CardsPerRegion, G1ClearCardTableTask::chunk_size()) / G1ClearCardTableTask::chunk_size(); |
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
262 |
uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers()); |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
263 |
size_t const chunk_length = G1ClearCardTableTask::chunk_size() / HeapRegion::CardsPerRegion; |
38154 | 264 |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
265 |
// Iterate over the dirty cards region list. |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
266 |
G1ClearCardTableTask cl(G1CollectedHeap::heap(), _dirty_region_buffer, _cur_dirty_region, chunk_length); |
38154 | 267 |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
268 |
log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " " |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
269 |
"units of work for " SIZE_FORMAT " regions.", |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
270 |
cl.name(), num_workers, num_chunks, _cur_dirty_region); |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
271 |
workers->run_task(&cl, num_workers); |
38154 | 272 |
|
273 |
#ifndef PRODUCT |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
274 |
// Need to synchronize with concurrent cleanup since it needs to |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
275 |
// finish its card table clearing before we can verify. |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
276 |
G1CollectedHeap::heap()->wait_while_free_regions_coming(); |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
277 |
G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup(); |
38154 | 278 |
#endif |
279 |
} |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
280 |
}; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
281 |
|
38172
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
282 |
G1RemSet::G1RemSet(G1CollectedHeap* g1, |
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
283 |
CardTableModRefBS* ct_bs, |
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
284 |
G1HotCardCache* hot_card_cache) : |
35198
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
285 |
_g1(g1), |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
286 |
_scan_state(new G1RemSetScanState()), |
46614
ae1105fff9e4
8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents:
46611
diff
changeset
|
287 |
_num_conc_refined_cards(0), |
35198
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
288 |
_ct_bs(ct_bs), |
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
289 |
_g1p(_g1->g1_policy()), |
38172
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
290 |
_hot_card_cache(hot_card_cache), |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
291 |
_prev_period_summary() { |
1374 | 292 |
} |
293 |
||
6958 | 294 |
G1RemSet::~G1RemSet() { |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
295 |
if (_scan_state != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
296 |
delete _scan_state; |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
297 |
} |
1374 | 298 |
} |
299 |
||
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
300 |
uint G1RemSet::num_par_rem_sets() { |
48103
26dbe08d1c17
8190426: Lazily initialize refinement threads with UseDynamicNumberOfGCThreads
tschatzl
parents:
47885
diff
changeset
|
301 |
return MAX2(DirtyCardQueueSet::num_par_ids() + G1ConcurrentRefine::max_num_threads(), ParallelGCThreads); |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
302 |
} |
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
303 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
304 |
void G1RemSet::initialize(size_t capacity, uint max_regions) { |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
305 |
G1FromCardCache::initialize(num_par_rem_sets(), max_regions); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
306 |
_scan_state->initialize(max_regions); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
307 |
{ |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
308 |
GCTraceTime(Debug, gc, marking)("Initialize Card Live Data"); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
309 |
_card_live_data.initialize(capacity, max_regions); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
310 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
311 |
if (G1PretouchAuxiliaryMemory) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
312 |
GCTraceTime(Debug, gc, marking)("Pre-Touch Card Live Data"); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
313 |
_card_live_data.pretouch(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
314 |
} |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
315 |
} |
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
316 |
|
46575 | 317 |
G1ScanRSForRegionClosure::G1ScanRSForRegionClosure(G1RemSetScanState* scan_state, |
318 |
G1ScanObjsDuringScanRSClosure* scan_obj_on_card, |
|
319 |
CodeBlobClosure* code_root_cl, |
|
320 |
uint worker_i) : |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
321 |
_scan_state(scan_state), |
46572 | 322 |
_scan_objs_on_card_cl(scan_obj_on_card), |
35198
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
323 |
_code_root_cl(code_root_cl), |
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
324 |
_strong_code_root_scan_time_sec(0.0), |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
325 |
_cards_claimed(0), |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
326 |
_cards_scanned(0), |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
327 |
_cards_skipped(0), |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
328 |
_worker_i(worker_i) { |
34246 | 329 |
_g1h = G1CollectedHeap::heap(); |
35461 | 330 |
_bot = _g1h->bot(); |
34246 | 331 |
_ct_bs = _g1h->g1_barrier_set(); |
332 |
} |
|
333 |
||
46635 | 334 |
void G1ScanRSForRegionClosure::scan_card(MemRegion mr, uint region_idx_for_card) { |
335 |
HeapRegion* const card_region = _g1h->region_at(region_idx_for_card); |
|
336 |
_scan_objs_on_card_cl->set_region(card_region); |
|
337 |
card_region->oops_on_card_seq_iterate_careful<true>(mr, _scan_objs_on_card_cl); |
|
338 |
_cards_scanned++; |
|
34246 | 339 |
} |
1374 | 340 |
|
46575 | 341 |
void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) { |
34246 | 342 |
double scan_start = os::elapsedTime(); |
343 |
r->strong_code_roots_do(_code_root_cl); |
|
344 |
_strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start); |
|
345 |
} |
|
346 |
||
46635 | 347 |
void G1ScanRSForRegionClosure::claim_card(size_t card_index, const uint region_idx_for_card){ |
348 |
_ct_bs->set_card_claimed(card_index); |
|
349 |
_scan_state->add_dirty_region(region_idx_for_card); |
|
350 |
} |
|
351 |
||
48890
f9884e190f2b
8197493: [Backout] JDK-8196602 Change HeapRegionClosure to comply to naming conventions
tschatzl
parents:
48889
diff
changeset
|
352 |
bool G1ScanRSForRegionClosure::doHeapRegion(HeapRegion* r) { |
34246 | 353 |
assert(r->in_collection_set(), "should only be called on elements of CS."); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
354 |
uint region_idx = r->hrm_index(); |
34246 | 355 |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
356 |
if (_scan_state->iter_is_complete(region_idx)) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
357 |
return false; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
358 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
359 |
if (_scan_state->claim_iter(region_idx)) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
360 |
// If we ever free the collection set concurrently, we should also |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
361 |
// clear the card table concurrently therefore we won't need to |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
362 |
// add regions of the collection set to the dirty cards region. |
38154 | 363 |
_scan_state->add_dirty_region(region_idx); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
364 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
365 |
|
46575 | 366 |
// We claim cards in blocks so as to reduce the contention. |
367 |
size_t const block_size = G1RSetScanBlockSize; |
|
368 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
369 |
HeapRegionRemSetIterator iter(r->rem_set()); |
34246 | 370 |
size_t card_index; |
1374 | 371 |
|
46575 | 372 |
size_t claimed_card_block = _scan_state->iter_claimed_next(region_idx, block_size); |
34246 | 373 |
for (size_t current_card = 0; iter.has_next(card_index); current_card++) { |
46575 | 374 |
if (current_card >= claimed_card_block + block_size) { |
375 |
claimed_card_block = _scan_state->iter_claimed_next(region_idx, block_size); |
|
34246 | 376 |
} |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
377 |
if (current_card < claimed_card_block) { |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
378 |
_cards_skipped++; |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
379 |
continue; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
380 |
} |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
381 |
_cards_claimed++; |
34246 | 382 |
|
46635 | 383 |
// If the card is dirty, then G1 will scan it during Update RS. |
384 |
if (_ct_bs->is_card_claimed(card_index) || _ct_bs->is_card_dirty(card_index)) { |
|
385 |
continue; |
|
386 |
} |
|
387 |
||
388 |
HeapWord* const card_start = _g1h->bot()->address_for_index(card_index); |
|
389 |
uint const region_idx_for_card = _g1h->addr_to_region(card_start); |
|
34246 | 390 |
|
46635 | 391 |
assert(_g1h->region_at(region_idx_for_card)->is_in_reserved(card_start), |
392 |
"Card start " PTR_FORMAT " to scan outside of region %u", p2i(card_start), _g1h->region_at(region_idx_for_card)->hrm_index()); |
|
393 |
HeapWord* const top = _scan_state->scan_top(region_idx_for_card); |
|
394 |
if (card_start >= top) { |
|
395 |
continue; |
|
1374 | 396 |
} |
46635 | 397 |
|
398 |
// We claim lazily (so races are possible but they're benign), which reduces the |
|
399 |
// number of duplicate scans (the rsets of the regions in the cset can intersect). |
|
400 |
// Claim the card after checking bounds above: the remembered set may contain |
|
401 |
// random cards into current survivor, and we would then have an incorrectly |
|
402 |
// claimed card in survivor space. Card table clear does not reset the card table |
|
403 |
// of survivor space regions. |
|
404 |
claim_card(card_index, region_idx_for_card); |
|
405 |
||
406 |
MemRegion const mr(card_start, MIN2(card_start + BOTConstants::N_words, top)); |
|
407 |
||
408 |
scan_card(mr, region_idx_for_card); |
|
1374 | 409 |
} |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
410 |
if (_scan_state->set_iter_complete(region_idx)) { |
34246 | 411 |
// Scan the strong code root list attached to the current region |
412 |
scan_strong_code_roots(r); |
|
1374 | 413 |
} |
34246 | 414 |
return false; |
415 |
} |
|
1374 | 416 |
|
46572 | 417 |
void G1RemSet::scan_rem_set(G1ParScanThreadState* pss, |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
418 |
CodeBlobClosure* heap_region_codeblobs, |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
419 |
uint worker_i) { |
1374 | 420 |
double rs_time_start = os::elapsedTime(); |
32617
a59435e1fecc
8135012: Don't use G1RootProcessor when scanning remembered sets
mgerdin
parents:
31592
diff
changeset
|
421 |
|
46572 | 422 |
G1ScanObjsDuringScanRSClosure scan_cl(_g1, pss); |
46575 | 423 |
G1ScanRSForRegionClosure cl(_scan_state, &scan_cl, heap_region_codeblobs, worker_i); |
39698
4016de4e596b
8159978: Use an array to store the collection set regions instead of linking through regions
tschatzl
parents:
38172
diff
changeset
|
424 |
_g1->collection_set_iterate_from(&cl, worker_i); |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
425 |
|
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
426 |
double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) - |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
427 |
cl.strong_code_root_scan_time_sec(); |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
428 |
|
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
429 |
G1GCPhaseTimes* p = _g1p->phase_times(); |
1374 | 430 |
|
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
431 |
p->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
432 |
p->record_thread_work_item(G1GCPhaseTimes::ScanRS, worker_i, cl.cards_scanned(), G1GCPhaseTimes::ScanRSScannedCards); |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
433 |
p->record_thread_work_item(G1GCPhaseTimes::ScanRS, worker_i, cl.cards_claimed(), G1GCPhaseTimes::ScanRSClaimedCards); |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
434 |
p->record_thread_work_item(G1GCPhaseTimes::ScanRS, worker_i, cl.cards_skipped(), G1GCPhaseTimes::ScanRSSkippedCards); |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32617
diff
changeset
|
435 |
|
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
436 |
p->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, cl.strong_code_root_scan_time_sec()); |
1374 | 437 |
} |
438 |
||
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
439 |
// Closure used for updating rem sets. Only called during an evacuation pause. |
46580
130fde4acb34
8183122: Rename RefineRecordRefsIntoCSCardTableEntryClosure to G1RefineCardClosure
ehelin
parents:
46575
diff
changeset
|
440 |
class G1RefineCardClosure: public CardTableEntryClosure { |
6247 | 441 |
G1RemSet* _g1rs; |
46572 | 442 |
G1ScanObjsDuringUpdateRSClosure* _update_rs_cl; |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
443 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
444 |
size_t _cards_scanned; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
445 |
size_t _cards_skipped; |
6247 | 446 |
public: |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
447 |
G1RefineCardClosure(G1CollectedHeap* g1h, G1ScanObjsDuringUpdateRSClosure* update_rs_cl) : |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
448 |
_g1rs(g1h->g1_rem_set()), _update_rs_cl(update_rs_cl), _cards_scanned(0), _cards_skipped(0) |
6247 | 449 |
{} |
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
450 |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
451 |
bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
6247 | 452 |
// The only time we care about recording cards that |
453 |
// contain references that point into the collection set |
|
454 |
// is during RSet updating within an evacuation pause. |
|
455 |
// In this case worker_i should be the id of a GC worker thread. |
|
456 |
assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
|
1374 | 457 |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
458 |
bool card_scanned = _g1rs->refine_card_during_gc(card_ptr, _update_rs_cl); |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
459 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
460 |
if (card_scanned) { |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
461 |
_cards_scanned++; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
462 |
} else { |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
463 |
_cards_skipped++; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
464 |
} |
6247 | 465 |
return true; |
466 |
} |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
467 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
468 |
size_t cards_scanned() const { return _cards_scanned; } |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
469 |
size_t cards_skipped() const { return _cards_skipped; } |
6247 | 470 |
}; |
471 |
||
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
472 |
void G1RemSet::update_rem_set(G1ParScanThreadState* pss, uint worker_i) { |
46572 | 473 |
G1ScanObjsDuringUpdateRSClosure update_rs_cl(_g1, pss, worker_i); |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
474 |
G1RefineCardClosure refine_card_cl(_g1, &update_rs_cl); |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
475 |
|
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
476 |
G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i); |
38172
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
477 |
if (G1HotCardCache::default_use_cache()) { |
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
478 |
// 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
|
479 |
G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i); |
46580
130fde4acb34
8183122: Rename RefineRecordRefsIntoCSCardTableEntryClosure to G1RefineCardClosure
ehelin
parents:
46575
diff
changeset
|
480 |
_g1->iterate_hcc_closure(&refine_card_cl, worker_i); |
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
481 |
} |
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
482 |
// Apply the closure to all remaining log entries. |
46580
130fde4acb34
8183122: Rename RefineRecordRefsIntoCSCardTableEntryClosure to G1RefineCardClosure
ehelin
parents:
46575
diff
changeset
|
483 |
_g1->iterate_dirty_card_closure(&refine_card_cl, worker_i); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
484 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
485 |
G1GCPhaseTimes* p = _g1p->phase_times(); |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
486 |
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_scanned(), G1GCPhaseTimes::UpdateRSScannedCards); |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
487 |
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_skipped(), G1GCPhaseTimes::UpdateRSSkippedCards); |
1374 | 488 |
} |
489 |
||
6958 | 490 |
void G1RemSet::cleanupHRRS() { |
1374 | 491 |
HeapRegionRemSet::cleanup(); |
492 |
} |
|
493 |
||
46572 | 494 |
void G1RemSet::oops_into_collection_set_do(G1ParScanThreadState* pss, |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
495 |
CodeBlobClosure* heap_region_codeblobs, |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
496 |
uint worker_i) { |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
497 |
update_rem_set(pss, worker_i); |
46572 | 498 |
scan_rem_set(pss, heap_region_codeblobs, worker_i);; |
1374 | 499 |
} |
500 |
||
6958 | 501 |
void G1RemSet::prepare_for_oops_into_collection_set_do() { |
1374 | 502 |
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); |
503 |
dcqs.concatenate_logs(); |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
504 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
505 |
_scan_state->reset(); |
1374 | 506 |
} |
507 |
||
6958 | 508 |
void G1RemSet::cleanup_after_oops_into_collection_set_do() { |
38154 | 509 |
G1GCPhaseTimes* phase_times = _g1->g1_policy()->phase_times(); |
510 |
||
1374 | 511 |
// Set all cards back to clean. |
38154 | 512 |
double start = os::elapsedTime(); |
513 |
_scan_state->clear_card_table(_g1->workers()); |
|
514 |
phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0); |
|
1374 | 515 |
} |
516 |
||
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
517 |
class G1ScrubRSClosure: public HeapRegionClosure { |
1374 | 518 |
G1CollectedHeap* _g1h; |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
519 |
G1CardLiveData* _live_data; |
1374 | 520 |
public: |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
521 |
G1ScrubRSClosure(G1CardLiveData* live_data) : |
1374 | 522 |
_g1h(G1CollectedHeap::heap()), |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
523 |
_live_data(live_data) { } |
1374 | 524 |
|
48890
f9884e190f2b
8197493: [Backout] JDK-8196602 Change HeapRegionClosure to comply to naming conventions
tschatzl
parents:
48889
diff
changeset
|
525 |
bool doHeapRegion(HeapRegion* r) { |
26846
7d4376f8560e
8058495: G1: normalize names for isHumongous() and friends
tonyp
parents:
26701
diff
changeset
|
526 |
if (!r->is_continues_humongous()) { |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
527 |
r->rem_set()->scrub(_live_data); |
1374 | 528 |
} |
529 |
return false; |
|
530 |
} |
|
531 |
}; |
|
532 |
||
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
533 |
void G1RemSet::scrub(uint worker_num, HeapRegionClaimer *hrclaimer) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
534 |
G1ScrubRSClosure scrub_cl(&_card_live_data); |
47885
5caa1d5f74c1
8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
47789
diff
changeset
|
535 |
_g1->heap_region_par_iterate_from_worker_offset(&scrub_cl, hrclaimer, worker_num); |
1374 | 536 |
} |
537 |
||
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
538 |
inline void check_card_ptr(jbyte* card_ptr, CardTableModRefBS* ct_bs) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
539 |
#ifdef ASSERT |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
540 |
G1CollectedHeap* g1 = G1CollectedHeap::heap(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
541 |
assert(g1->is_in_exact(ct_bs->addr_for(card_ptr)), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
542 |
"Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
543 |
p2i(card_ptr), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
544 |
ct_bs->index_for(ct_bs->addr_for(card_ptr)), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
545 |
p2i(ct_bs->addr_for(card_ptr)), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
546 |
g1->addr_to_region(ct_bs->addr_for(card_ptr))); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
547 |
#endif |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
548 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
549 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
550 |
void G1RemSet::refine_card_concurrently(jbyte* card_ptr, |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
551 |
uint worker_i) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
552 |
assert(!_g1->is_gc_active(), "Only call concurrently"); |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
553 |
|
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
554 |
check_card_ptr(card_ptr, _ct_bs); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
555 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
556 |
// 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
|
557 |
if (*card_ptr != CardTableModRefBS::dirty_card_val()) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
558 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
559 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
560 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
561 |
// Construct the region representing the card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
562 |
HeapWord* start = _ct_bs->addr_for(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
563 |
// And find the region containing it. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
564 |
HeapRegion* r = _g1->heap_region_containing(start); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
565 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
566 |
// This check is needed for some uncommon cases where we should |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
567 |
// ignore the card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
568 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
569 |
// The region could be young. Cards for young regions are |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
570 |
// distinctly marked (set to g1_young_gen), so the post-barrier will |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
571 |
// filter them out. However, that marking is performed |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
572 |
// concurrently. A write to a young object could occur before the |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
573 |
// card has been marked young, slipping past the filter. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
574 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
575 |
// The card could be stale, because the region has been freed since |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
576 |
// the card was recorded. In this case the region type could be |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
577 |
// anything. If (still) free or (reallocated) young, just ignore |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
578 |
// it. If (reallocated) old or humongous, the later card trimming |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
579 |
// and additional checks in iteration may detect staleness. At |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
580 |
// worst, we end up processing a stale card unnecessarily. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
581 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
582 |
// In the normal (non-stale) case, the synchronization between the |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
583 |
// enqueueing of the card and processing it here will have ensured |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
584 |
// we see the up-to-date region type here. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
585 |
if (!r->is_old_or_humongous()) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
586 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
587 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
588 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
589 |
// The result from the hot card cache insert call is either: |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
590 |
// * pointer to the current card |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
591 |
// (implying that the current card is not 'hot'), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
592 |
// * null |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
593 |
// (meaning we had inserted the card ptr into the "hot" card cache, |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
594 |
// which had some headroom), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
595 |
// * a pointer to a "hot" card that was evicted from the "hot" cache. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
596 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
597 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
598 |
if (_hot_card_cache->use_cache()) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
599 |
assert(!SafepointSynchronize::is_at_safepoint(), "sanity"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
600 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
601 |
const jbyte* orig_card_ptr = card_ptr; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
602 |
card_ptr = _hot_card_cache->insert(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
603 |
if (card_ptr == NULL) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
604 |
// There was no eviction. Nothing to do. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
605 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
606 |
} else if (card_ptr != orig_card_ptr) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
607 |
// Original card was inserted and an old card was evicted. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
608 |
start = _ct_bs->addr_for(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
609 |
r = _g1->heap_region_containing(start); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
610 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
611 |
// Check whether the region formerly in the cache should be |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
612 |
// ignored, as discussed earlier for the original card. The |
48778
808555a54e9c
8196883: G1RemSet::refine_card_concurrently doesn't need to check for cards in collection set
tschatzl
parents:
48103
diff
changeset
|
613 |
// region could have been freed while in the cache. |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
614 |
if (!r->is_old_or_humongous()) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
615 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
616 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
617 |
} // Else we still have the original card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
618 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
619 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
620 |
// Trim the region designated by the card to what's been allocated |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
621 |
// in the region. The card could be stale, or the card could cover |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
622 |
// (part of) an object at the end of the allocated space and extend |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
623 |
// beyond the end of allocation. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
624 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
625 |
// Non-humongous objects are only allocated in the old-gen during |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
626 |
// GC, so if region is old then top is stable. Humongous object |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
627 |
// allocation sets top last; if top has not yet been set, this is |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
628 |
// a stale card and we'll end up with an empty intersection. If |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
629 |
// this is not a stale card, the synchronization between the |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
630 |
// enqueuing of the card and processing it here will have ensured |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
631 |
// we see the up-to-date top here. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
632 |
HeapWord* scan_limit = r->top(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
633 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
634 |
if (scan_limit <= start) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
635 |
// If the trimmed region is empty, the card must be stale. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
636 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
637 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
638 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
639 |
// Okay to clean and process the card now. There are still some |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
640 |
// stale card cases that may be detected by iteration and dealt with |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
641 |
// as iteration failure. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
642 |
*const_cast<volatile jbyte*>(card_ptr) = CardTableModRefBS::clean_card_val(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
643 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
644 |
// This fence serves two purposes. First, the card must be cleaned |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
645 |
// before processing the contents. Second, we can't proceed with |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
646 |
// processing until after the read of top, for synchronization with |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
647 |
// possibly concurrent humongous object allocation. It's okay that |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
648 |
// reading top and reading type were racy wrto each other. We need |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
649 |
// both set, in any order, to proceed. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
650 |
OrderAccess::fence(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
651 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
652 |
// Don't use addr_for(card_ptr + 1) which can ask for |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
653 |
// a card beyond the heap. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
654 |
HeapWord* end = start + CardTableModRefBS::card_size_in_words; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
655 |
MemRegion dirty_region(start, MIN2(scan_limit, end)); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
656 |
assert(!dirty_region.is_empty(), "sanity"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
657 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
658 |
G1ConcurrentRefineOopClosure conc_refine_cl(_g1, worker_i); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
659 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
660 |
bool card_processed = |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
661 |
r->oops_on_card_seq_iterate_careful<false>(dirty_region, &conc_refine_cl); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
662 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
663 |
// If unable to process the card then we encountered an unparsable |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
664 |
// part of the heap (e.g. a partially allocated object) while |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
665 |
// processing a stale card. Despite the card being stale, redirty |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
666 |
// and re-enqueue, because we've already cleaned the card. Without |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
667 |
// this we could incorrectly discard a non-stale card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
668 |
if (!card_processed) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
669 |
// The card might have gotten re-dirtied and re-enqueued while we |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
670 |
// worked. (In fact, it's pretty likely.) |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
671 |
if (*card_ptr != CardTableModRefBS::dirty_card_val()) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
672 |
*card_ptr = CardTableModRefBS::dirty_card_val(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
673 |
MutexLockerEx x(Shared_DirtyCardQ_lock, |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
674 |
Mutex::_no_safepoint_check_flag); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
675 |
DirtyCardQueue* sdcq = |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
676 |
JavaThread::dirty_card_queue_set().shared_dirty_card_queue(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
677 |
sdcq->enqueue(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
678 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
679 |
} else { |
46614
ae1105fff9e4
8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents:
46611
diff
changeset
|
680 |
_num_conc_refined_cards++; // Unsynchronized update, only used for logging. |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
681 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
682 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
683 |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
684 |
bool G1RemSet::refine_card_during_gc(jbyte* card_ptr, |
46572 | 685 |
G1ScanObjsDuringUpdateRSClosure* update_rs_cl) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
686 |
assert(_g1->is_gc_active(), "Only call during GC"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
687 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
688 |
check_card_ptr(card_ptr, _ct_bs); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
689 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
690 |
// If the card is no longer dirty, nothing to do. This covers cards that were already |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
691 |
// scanned as parts of the remembered sets. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
692 |
if (*card_ptr != CardTableModRefBS::dirty_card_val()) { |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
693 |
return false; |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
694 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
695 |
|
46676 | 696 |
// We claim lazily (so races are possible but they're benign), which reduces the |
697 |
// number of potential duplicate scans (multiple threads may enqueue the same card twice). |
|
698 |
*card_ptr = CardTableModRefBS::clean_card_val() | CardTableModRefBS::claimed_card_val(); |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
699 |
|
46520 | 700 |
// Construct the region representing the card. |
701 |
HeapWord* card_start = _ct_bs->addr_for(card_ptr); |
|
702 |
// And find the region containing it. |
|
46676 | 703 |
uint const card_region_idx = _g1->addr_to_region(card_start); |
46520 | 704 |
|
46676 | 705 |
_scan_state->add_dirty_region(card_region_idx); |
706 |
HeapWord* scan_limit = _scan_state->scan_top(card_region_idx); |
|
46520 | 707 |
if (scan_limit <= card_start) { |
708 |
// If the card starts above the area in the region containing objects to scan, skip it. |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
709 |
return false; |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
710 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
711 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
712 |
// Don't use addr_for(card_ptr + 1) which can ask for |
42589
037b433e8069
8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents:
42588
diff
changeset
|
713 |
// a card beyond the heap. |
46520 | 714 |
HeapWord* card_end = card_start + CardTableModRefBS::card_size_in_words; |
715 |
MemRegion dirty_region(card_start, MIN2(scan_limit, card_end)); |
|
42589
037b433e8069
8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents:
42588
diff
changeset
|
716 |
assert(!dirty_region.is_empty(), "sanity"); |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
717 |
|
46676 | 718 |
HeapRegion* const card_region = _g1->region_at(card_region_idx); |
719 |
update_rs_cl->set_region(card_region); |
|
720 |
bool card_processed = card_region->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl); |
|
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
721 |
assert(card_processed, "must be"); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
722 |
return true; |
1374 | 723 |
} |
724 |
||
35061 | 725 |
void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) { |
726 |
if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) && |
|
727 |
(period_count % G1SummarizeRSetStatsPeriod == 0)) { |
|
728 |
||
46652
ab8716d193bb
8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents:
46635
diff
changeset
|
729 |
G1RemSetSummary current(this); |
35061 | 730 |
_prev_period_summary.subtract_from(¤t); |
1374 | 731 |
|
37242 | 732 |
Log(gc, remset) log; |
35061 | 733 |
log.trace("%s", header); |
734 |
ResourceMark rm; |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
735 |
LogStream ls(log.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
736 |
_prev_period_summary.print_on(&ls); |
35061 | 737 |
|
738 |
_prev_period_summary.set(¤t); |
|
739 |
} |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
740 |
} |
2881 | 741 |
|
6958 | 742 |
void G1RemSet::print_summary_info() { |
37242 | 743 |
Log(gc, remset, exit) log; |
35061 | 744 |
if (log.is_trace()) { |
745 |
log.trace(" Cumulative RS summary"); |
|
46653 | 746 |
G1RemSetSummary current(this); |
35061 | 747 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
748 |
LogStream ls(log.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
749 |
current.print_on(&ls); |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
750 |
} |
1374 | 751 |
} |
6247 | 752 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
753 |
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
|
754 |
_card_live_data.create(workers, mark_bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
755 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
756 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
757 |
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
|
758 |
_card_live_data.finalize(workers, mark_bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
759 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
760 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
761 |
void G1RemSet::verify_card_live_data(WorkGang* workers, G1CMBitMap* bitmap) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
762 |
_card_live_data.verify(workers, bitmap); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
763 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
764 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
765 |
void G1RemSet::clear_card_live_data(WorkGang* workers) { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
766 |
_card_live_data.clear(workers); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
767 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
768 |
|
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
769 |
#ifdef ASSERT |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
770 |
void G1RemSet::verify_card_live_data_is_clear() { |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
771 |
_card_live_data.verify_is_clear(); |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
772 |
} |
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
773 |
#endif |