author | iignatyev |
Thu, 28 Feb 2019 09:10:46 -0800 | |
changeset 53956 | d5bd4d5483e4 |
parent 53820 | 4fb7f7e3e05b |
child 53985 | 0da5c17f5e43 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
2 |
* Copyright (c) 2001, 2019, 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" |
49751
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49634
diff
changeset
|
26 |
#include "gc/g1/g1BarrierSet.hpp" |
30764 | 27 |
#include "gc/g1/g1BlockOffsetTable.inline.hpp" |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
28 |
#include "gc/g1/g1CardTable.inline.hpp" |
30764 | 29 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
47789
a77a7d3bc4f6
8149127: Rename g1/concurrentMarkThread.* to g1/g1ConcurrentMarkThread.*
tschatzl
parents:
47647
diff
changeset
|
30 |
#include "gc/g1/g1ConcurrentRefine.hpp" |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
31 |
#include "gc/g1/g1DirtyCardQueue.hpp" |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
32 |
#include "gc/g1/g1FromCardCache.hpp" |
30764 | 33 |
#include "gc/g1/g1GCPhaseTimes.hpp" |
34 |
#include "gc/g1/g1HotCardCache.hpp" |
|
35 |
#include "gc/g1/g1OopClosures.inline.hpp" |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
36 |
#include "gc/g1/g1RootClosures.hpp" |
47885
5caa1d5f74c1
8186571: Implementation: JEP 307: Parallel Full GC for G1
sjohanss
parents:
47789
diff
changeset
|
37 |
#include "gc/g1/g1RemSet.hpp" |
35198
1365be812a7d
8145674: Fix includes and forward declarations in g1Remset files
tschatzl
parents:
35068
diff
changeset
|
38 |
#include "gc/g1/heapRegion.inline.hpp" |
30764 | 39 |
#include "gc/g1/heapRegionManager.inline.hpp" |
40 |
#include "gc/g1/heapRegionRemSet.hpp" |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
41 |
#include "gc/shared/gcTraceTime.inline.hpp" |
47647
64dba69fc528
8189276: Make SuspendibleThreadSet and related code available to other GCs
rkennke
parents:
47216
diff
changeset
|
42 |
#include "gc/shared/suspendibleThreadSet.hpp" |
51877
5f931e3e7a63
8196341: Add JFR events for parallel phases of G1
lkorinth
parents:
51494
diff
changeset
|
43 |
#include "jfr/jfrEvents.hpp" |
7397 | 44 |
#include "memory/iterator.hpp" |
37248 | 45 |
#include "memory/resourceArea.hpp" |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
46 |
#include "oops/access.inline.hpp" |
7397 | 47 |
#include "oops/oop.inline.hpp" |
50113 | 48 |
#include "runtime/os.hpp" |
46625 | 49 |
#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
|
50 |
#include "utilities/globalDefinitions.hpp" |
30175 | 51 |
#include "utilities/stack.inline.hpp" |
50113 | 52 |
#include "utilities/ticks.hpp" |
1374 | 53 |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
54 |
// 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
|
55 |
class G1RemSetScanState : public CHeapObj<mtGC> { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
56 |
private: |
38154 | 57 |
class G1ClearCardTableTask : public AbstractGangTask { |
58 |
G1CollectedHeap* _g1h; |
|
59 |
uint* _dirty_region_list; |
|
60 |
size_t _num_dirty_regions; |
|
61 |
size_t _chunk_length; |
|
62 |
||
63 |
size_t volatile _cur_dirty_regions; |
|
64 |
public: |
|
65 |
G1ClearCardTableTask(G1CollectedHeap* g1h, |
|
66 |
uint* dirty_region_list, |
|
67 |
size_t num_dirty_regions, |
|
68 |
size_t chunk_length) : |
|
69 |
AbstractGangTask("G1 Clear Card Table Task"), |
|
70 |
_g1h(g1h), |
|
71 |
_dirty_region_list(dirty_region_list), |
|
72 |
_num_dirty_regions(num_dirty_regions), |
|
73 |
_chunk_length(chunk_length), |
|
74 |
_cur_dirty_regions(0) { |
|
75 |
||
76 |
assert(chunk_length > 0, "must be"); |
|
77 |
} |
|
78 |
||
79 |
static size_t chunk_size() { return M; } |
|
80 |
||
81 |
void work(uint worker_id) { |
|
82 |
while (_cur_dirty_regions < _num_dirty_regions) { |
|
83 |
size_t next = Atomic::add(_chunk_length, &_cur_dirty_regions) - _chunk_length; |
|
84 |
size_t max = MIN2(next + _chunk_length, _num_dirty_regions); |
|
85 |
||
86 |
for (size_t i = next; i < max; i++) { |
|
87 |
HeapRegion* r = _g1h->region_at(_dirty_region_list[i]); |
|
88 |
if (!r->is_survivor()) { |
|
49632
64f9ebc85e67
8197573: Remove concurrent cleanup and secondary free list handling
tschatzl
parents:
49607
diff
changeset
|
89 |
r->clear_cardtable(); |
38154 | 90 |
} |
91 |
} |
|
92 |
} |
|
93 |
} |
|
94 |
}; |
|
95 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
96 |
size_t _max_regions; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
97 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
98 |
// 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
|
99 |
// Unclaimed -> Claimed -> Complete. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
100 |
// 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
|
101 |
// 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
|
102 |
typedef jint G1RemsetIterState; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
103 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
108 |
G1RemsetIterState volatile* _iter_states; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
109 |
// 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
|
110 |
// remembered set. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
111 |
size_t volatile* _iter_claims; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
112 |
|
38154 | 113 |
// Temporary buffer holding the regions we used to store remembered set scan duplicate |
114 |
// information. These are also called "dirty". Valid entries are from [0.._cur_dirty_region) |
|
115 |
uint* _dirty_region_buffer; |
|
116 |
||
117 |
typedef jbyte IsDirtyRegionState; |
|
118 |
static const IsDirtyRegionState Clean = 0; |
|
119 |
static const IsDirtyRegionState Dirty = 1; |
|
120 |
// Holds a flag for every region whether it is in the _dirty_region_buffer already |
|
121 |
// to avoid duplicates. Uses jbyte since there are no atomic instructions for bools. |
|
122 |
IsDirtyRegionState* _in_dirty_region_buffer; |
|
123 |
size_t _cur_dirty_region; |
|
46520 | 124 |
|
125 |
// Creates a snapshot of the current _top values at the start of collection to |
|
126 |
// filter out card marks that we do not want to scan. |
|
127 |
class G1ResetScanTopClosure : public HeapRegionClosure { |
|
128 |
private: |
|
129 |
HeapWord** _scan_top; |
|
130 |
public: |
|
131 |
G1ResetScanTopClosure(HeapWord** scan_top) : _scan_top(scan_top) { } |
|
132 |
||
48950
f323537c9b75
8196602: Change HeapRegionClosure to comply to naming conventions
tschatzl
parents:
48103
diff
changeset
|
133 |
virtual bool do_heap_region(HeapRegion* r) { |
46520 | 134 |
uint hrm_index = r->hrm_index(); |
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
135 |
if (!r->in_collection_set() && r->is_old_or_humongous_or_archive() && !r->is_empty()) { |
46520 | 136 |
_scan_top[hrm_index] = r->top(); |
137 |
} else { |
|
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
138 |
_scan_top[hrm_index] = NULL; |
46520 | 139 |
} |
140 |
return false; |
|
141 |
} |
|
142 |
}; |
|
143 |
||
144 |
// For each region, contains the maximum top() value to be used during this garbage |
|
145 |
// collection. Subsumes common checks like filtering out everything but old and |
|
146 |
// humongous regions outside the collection set. |
|
147 |
// This is valid because we are not interested in scanning stray remembered set |
|
148 |
// entries from free or archive regions. |
|
149 |
HeapWord** _scan_top; |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
150 |
public: |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
151 |
G1RemSetScanState() : |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
152 |
_max_regions(0), |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
153 |
_iter_states(NULL), |
38154 | 154 |
_iter_claims(NULL), |
155 |
_dirty_region_buffer(NULL), |
|
156 |
_in_dirty_region_buffer(NULL), |
|
46520 | 157 |
_cur_dirty_region(0), |
158 |
_scan_top(NULL) { |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
159 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
160 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
161 |
~G1RemSetScanState() { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
162 |
if (_iter_states != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
163 |
FREE_C_HEAP_ARRAY(G1RemsetIterState, _iter_states); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
164 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
165 |
if (_iter_claims != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
166 |
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
|
167 |
} |
38154 | 168 |
if (_dirty_region_buffer != NULL) { |
169 |
FREE_C_HEAP_ARRAY(uint, _dirty_region_buffer); |
|
170 |
} |
|
171 |
if (_in_dirty_region_buffer != NULL) { |
|
172 |
FREE_C_HEAP_ARRAY(IsDirtyRegionState, _in_dirty_region_buffer); |
|
173 |
} |
|
46520 | 174 |
if (_scan_top != NULL) { |
175 |
FREE_C_HEAP_ARRAY(HeapWord*, _scan_top); |
|
176 |
} |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
177 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
178 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
179 |
void initialize(uint max_regions) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
180 |
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
|
181 |
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
|
182 |
_max_regions = max_regions; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
183 |
_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
|
184 |
_iter_claims = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC); |
38154 | 185 |
_dirty_region_buffer = NEW_C_HEAP_ARRAY(uint, max_regions, mtGC); |
186 |
_in_dirty_region_buffer = NEW_C_HEAP_ARRAY(IsDirtyRegionState, max_regions, mtGC); |
|
46520 | 187 |
_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
|
188 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
189 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
190 |
void reset() { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
191 |
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
|
192 |
_iter_states[i] = Unclaimed; |
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
193 |
_scan_top[i] = NULL; |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
194 |
} |
46520 | 195 |
|
196 |
G1ResetScanTopClosure cl(_scan_top); |
|
197 |
G1CollectedHeap::heap()->heap_region_iterate(&cl); |
|
198 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
199 |
memset((void*)_iter_claims, 0, _max_regions * sizeof(size_t)); |
38154 | 200 |
memset(_in_dirty_region_buffer, Clean, _max_regions * sizeof(IsDirtyRegionState)); |
201 |
_cur_dirty_region = 0; |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
202 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
203 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
204 |
// 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
|
205 |
// 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
|
206 |
inline bool claim_iter(uint region) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
207 |
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
|
208 |
if (_iter_states[region] != Unclaimed) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
209 |
return false; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
210 |
} |
48955
e22914003cf0
8194691: Cleanup unnecessary casts in Atomic/OrderAccess uses
kbarrett
parents:
48954
diff
changeset
|
211 |
G1RemsetIterState res = Atomic::cmpxchg(Claimed, &_iter_states[region], Unclaimed); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
212 |
return (res == Unclaimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
213 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
214 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
215 |
// 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
|
216 |
// thread that caused the transition. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
217 |
inline bool set_iter_complete(uint region) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
218 |
if (iter_is_complete(region)) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
219 |
return false; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
220 |
} |
48955
e22914003cf0
8194691: Cleanup unnecessary casts in Atomic/OrderAccess uses
kbarrett
parents:
48954
diff
changeset
|
221 |
G1RemsetIterState res = Atomic::cmpxchg(Complete, &_iter_states[region], Claimed); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
222 |
return (res == Claimed); |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
223 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
224 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
225 |
// 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
|
226 |
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
|
227 |
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
|
228 |
return _iter_states[region] == Complete; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
229 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
230 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
231 |
// 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
|
232 |
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
|
233 |
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
|
234 |
return _iter_claims[region]; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
235 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
236 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
237 |
// 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
|
238 |
// step size. |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
239 |
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
|
240 |
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
|
241 |
} |
38154 | 242 |
|
243 |
void add_dirty_region(uint region) { |
|
244 |
if (_in_dirty_region_buffer[region] == Dirty) { |
|
245 |
return; |
|
246 |
} |
|
247 |
||
248 |
bool marked_as_dirty = Atomic::cmpxchg(Dirty, &_in_dirty_region_buffer[region], Clean) == Clean; |
|
249 |
if (marked_as_dirty) { |
|
46993
dd0f91c85ffc
8186476: Generalize Atomic::add with templates
eosterlund
parents:
46778
diff
changeset
|
250 |
size_t allocated = Atomic::add(1u, &_cur_dirty_region) - 1; |
38154 | 251 |
_dirty_region_buffer[allocated] = region; |
252 |
} |
|
253 |
} |
|
254 |
||
46520 | 255 |
HeapWord* scan_top(uint region_idx) const { |
256 |
return _scan_top[region_idx]; |
|
257 |
} |
|
258 |
||
38154 | 259 |
// Clear the card table of "dirty" regions. |
260 |
void clear_card_table(WorkGang* workers) { |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
261 |
if (_cur_dirty_region == 0) { |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
262 |
return; |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
263 |
} |
38154 | 264 |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46614
diff
changeset
|
265 |
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
|
266 |
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
|
267 |
size_t const chunk_length = G1ClearCardTableTask::chunk_size() / HeapRegion::CardsPerRegion; |
38154 | 268 |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
269 |
// Iterate over the dirty cards region list. |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
270 |
G1ClearCardTableTask cl(G1CollectedHeap::heap(), _dirty_region_buffer, _cur_dirty_region, chunk_length); |
38154 | 271 |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
272 |
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
|
273 |
"units of work for " SIZE_FORMAT " regions.", |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
274 |
cl.name(), num_workers, num_chunks, _cur_dirty_region); |
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
275 |
workers->run_task(&cl, num_workers); |
38154 | 276 |
|
277 |
#ifndef PRODUCT |
|
38160
13a14d5777b0
8155813: Fix indentation in G1RemSetScanState::clear_card_table()
tschatzl
parents:
38154
diff
changeset
|
278 |
G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup(); |
38154 | 279 |
#endif |
280 |
} |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
281 |
}; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
282 |
|
49806 | 283 |
G1RemSet::G1RemSet(G1CollectedHeap* g1h, |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
284 |
G1CardTable* ct, |
38172
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
285 |
G1HotCardCache* hot_card_cache) : |
51332 | 286 |
_scan_state(new G1RemSetScanState()), |
287 |
_prev_period_summary(), |
|
49806 | 288 |
_g1h(g1h), |
46614
ae1105fff9e4
8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents:
46611
diff
changeset
|
289 |
_num_conc_refined_cards(0), |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
290 |
_ct(ct), |
49806 | 291 |
_g1p(_g1h->g1_policy()), |
51332 | 292 |
_hot_card_cache(hot_card_cache) { |
1374 | 293 |
} |
294 |
||
6958 | 295 |
G1RemSet::~G1RemSet() { |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
296 |
if (_scan_state != NULL) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
297 |
delete _scan_state; |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2009
diff
changeset
|
298 |
} |
1374 | 299 |
} |
300 |
||
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
301 |
uint G1RemSet::num_par_rem_sets() { |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
302 |
return G1DirtyCardQueueSet::num_par_ids() + G1ConcurrentRefine::max_num_threads() + MAX2(ConcGCThreads, ParallelGCThreads); |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
303 |
} |
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
304 |
|
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
305 |
void G1RemSet::initialize(size_t capacity, uint max_regions) { |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
306 |
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
|
307 |
_scan_state->initialize(max_regions); |
35210
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
308 |
} |
eb1d5c68bf64
8145672: Remove dependency of G1FromCardCache to HeapRegionRemSet
tschatzl
parents:
35198
diff
changeset
|
309 |
|
46575 | 310 |
G1ScanRSForRegionClosure::G1ScanRSForRegionClosure(G1RemSetScanState* scan_state, |
311 |
G1ScanObjsDuringScanRSClosure* scan_obj_on_card, |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
312 |
G1ParScanThreadState* pss, |
52897
495c05ee2a9a
8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents:
52716
diff
changeset
|
313 |
G1GCPhaseTimes::GCParPhases phase, |
46575 | 314 |
uint worker_i) : |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
315 |
_g1h(G1CollectedHeap::heap()), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
316 |
_ct(_g1h->card_table()), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
317 |
_pss(pss), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
318 |
_scan_objs_on_card_cl(scan_obj_on_card), |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
319 |
_scan_state(scan_state), |
52897
495c05ee2a9a
8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents:
52716
diff
changeset
|
320 |
_phase(phase), |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
321 |
_worker_i(worker_i), |
51332 | 322 |
_cards_scanned(0), |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
323 |
_cards_claimed(0), |
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
324 |
_cards_skipped(0), |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
325 |
_rem_set_root_scan_time(), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
326 |
_rem_set_trim_partially_time(), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
327 |
_strong_code_root_scan_time(), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
328 |
_strong_code_trim_partially_time() { |
34246 | 329 |
} |
330 |
||
46635 | 331 |
void G1ScanRSForRegionClosure::claim_card(size_t card_index, const uint region_idx_for_card){ |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
332 |
_ct->set_card_claimed(card_index); |
46635 | 333 |
_scan_state->add_dirty_region(region_idx_for_card); |
334 |
} |
|
335 |
||
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
336 |
void G1ScanRSForRegionClosure::scan_card(MemRegion mr, uint region_idx_for_card) { |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
337 |
HeapRegion* const card_region = _g1h->region_at(region_idx_for_card); |
52348
21fdf8d9a8b6
8212911: Unify and micro-optimize handling of non-in-collection set references in oop closures
tschatzl
parents:
52345
diff
changeset
|
338 |
assert(!card_region->is_young(), "Should not scan card in young region %u", region_idx_for_card); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
339 |
card_region->oops_on_card_seq_iterate_careful<true>(mr, _scan_objs_on_card_cl); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
340 |
_scan_objs_on_card_cl->trim_queue_partially(); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
341 |
_cards_scanned++; |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
342 |
} |
34246 | 343 |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
344 |
void G1ScanRSForRegionClosure::scan_rem_set_roots(HeapRegion* r) { |
51877
5f931e3e7a63
8196341: Add JFR events for parallel phases of G1
lkorinth
parents:
51494
diff
changeset
|
345 |
EventGCPhaseParallel event; |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
346 |
uint const region_idx = r->hrm_index(); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
347 |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
348 |
if (_scan_state->claim_iter(region_idx)) { |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
349 |
// 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
|
350 |
// 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
|
351 |
// add regions of the collection set to the dirty cards region. |
38154 | 352 |
_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
|
353 |
} |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
354 |
|
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
355 |
if (r->rem_set()->cardset_is_empty()) { |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
356 |
return; |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
357 |
} |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
358 |
|
46575 | 359 |
// We claim cards in blocks so as to reduce the contention. |
360 |
size_t const block_size = G1RSetScanBlockSize; |
|
361 |
||
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
362 |
HeapRegionRemSetIterator iter(r->rem_set()); |
34246 | 363 |
size_t card_index; |
1374 | 364 |
|
46575 | 365 |
size_t claimed_card_block = _scan_state->iter_claimed_next(region_idx, block_size); |
34246 | 366 |
for (size_t current_card = 0; iter.has_next(card_index); current_card++) { |
46575 | 367 |
if (current_card >= claimed_card_block + block_size) { |
368 |
claimed_card_block = _scan_state->iter_claimed_next(region_idx, block_size); |
|
34246 | 369 |
} |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
370 |
if (current_card < claimed_card_block) { |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
371 |
_cards_skipped++; |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
372 |
continue; |
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
373 |
} |
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
374 |
_cards_claimed++; |
34246 | 375 |
|
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
376 |
HeapWord* const card_start = _g1h->bot()->address_for_index_raw(card_index); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
377 |
uint const region_idx_for_card = _g1h->addr_to_region(card_start); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
378 |
|
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
379 |
#ifdef ASSERT |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
380 |
HeapRegion* hr = _g1h->region_at_or_null(region_idx_for_card); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
381 |
assert(hr == NULL || hr->is_in_reserved(card_start), |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
382 |
"Card start " PTR_FORMAT " to scan outside of region %u", p2i(card_start), _g1h->region_at(region_idx_for_card)->hrm_index()); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
383 |
#endif |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
384 |
HeapWord* const top = _scan_state->scan_top(region_idx_for_card); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
385 |
if (card_start >= top) { |
46635 | 386 |
continue; |
387 |
} |
|
388 |
||
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
389 |
// If the card is dirty, then G1 will scan it during Update RS. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
390 |
if (_ct->is_card_claimed(card_index) || _ct->is_card_dirty(card_index)) { |
46635 | 391 |
continue; |
1374 | 392 |
} |
46635 | 393 |
|
394 |
// We claim lazily (so races are possible but they're benign), which reduces the |
|
395 |
// number of duplicate scans (the rsets of the regions in the cset can intersect). |
|
396 |
// Claim the card after checking bounds above: the remembered set may contain |
|
397 |
// random cards into current survivor, and we would then have an incorrectly |
|
398 |
// claimed card in survivor space. Card table clear does not reset the card table |
|
399 |
// of survivor space regions. |
|
400 |
claim_card(card_index, region_idx_for_card); |
|
401 |
||
402 |
MemRegion const mr(card_start, MIN2(card_start + BOTConstants::N_words, top)); |
|
403 |
||
404 |
scan_card(mr, region_idx_for_card); |
|
1374 | 405 |
} |
52897
495c05ee2a9a
8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents:
52716
diff
changeset
|
406 |
event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(_phase)); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
407 |
} |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
408 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
409 |
void G1ScanRSForRegionClosure::scan_strong_code_roots(HeapRegion* r) { |
51877
5f931e3e7a63
8196341: Add JFR events for parallel phases of G1
lkorinth
parents:
51494
diff
changeset
|
410 |
EventGCPhaseParallel event; |
53820
4fb7f7e3e05b
8219097: Move comment about using weak code blobs closure for code root scanning to correct place
tschatzl
parents:
53747
diff
changeset
|
411 |
// We pass a weak code blobs closure to the remembered set scanning because we want to avoid |
4fb7f7e3e05b
8219097: Move comment about using weak code blobs closure for code root scanning to correct place
tschatzl
parents:
53747
diff
changeset
|
412 |
// treating the nmethods visited to act as roots for concurrent marking. |
4fb7f7e3e05b
8219097: Move comment about using weak code blobs closure for code root scanning to correct place
tschatzl
parents:
53747
diff
changeset
|
413 |
// We only want to make sure that the oops in the nmethods are adjusted with regard to the |
4fb7f7e3e05b
8219097: Move comment about using weak code blobs closure for code root scanning to correct place
tschatzl
parents:
53747
diff
changeset
|
414 |
// objects copied by the current evacuation. |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
415 |
r->strong_code_roots_do(_pss->closures()->weak_codeblobs()); |
51877
5f931e3e7a63
8196341: Add JFR events for parallel phases of G1
lkorinth
parents:
51494
diff
changeset
|
416 |
event.commit(GCId::current(), _worker_i, G1GCPhaseTimes::phase_name(G1GCPhaseTimes::CodeRoots)); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
417 |
} |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
418 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
419 |
bool G1ScanRSForRegionClosure::do_heap_region(HeapRegion* r) { |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
420 |
assert(r->in_collection_set(), |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
421 |
"Should only be called on elements of the collection set but region %u is not.", |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
422 |
r->hrm_index()); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
423 |
uint const region_idx = r->hrm_index(); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
424 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
425 |
// Do an early out if we know we are complete. |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
426 |
if (_scan_state->iter_is_complete(region_idx)) { |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
427 |
return false; |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
428 |
} |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
429 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
430 |
{ |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
431 |
G1EvacPhaseWithTrimTimeTracker timer(_pss, _rem_set_root_scan_time, _rem_set_trim_partially_time); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
432 |
scan_rem_set_roots(r); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
433 |
} |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
434 |
|
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
435 |
if (_scan_state->set_iter_complete(region_idx)) { |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
436 |
G1EvacPhaseWithTrimTimeTracker timer(_pss, _strong_code_root_scan_time, _strong_code_trim_partially_time); |
34246 | 437 |
// Scan the strong code root list attached to the current region |
438 |
scan_strong_code_roots(r); |
|
1374 | 439 |
} |
34246 | 440 |
return false; |
441 |
} |
|
1374 | 442 |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
443 |
void G1RemSet::scan_rem_set(G1ParScanThreadState* pss, uint worker_i) { |
49806 | 444 |
G1ScanObjsDuringScanRSClosure scan_cl(_g1h, pss); |
52897
495c05ee2a9a
8213890: Implementation of JEP 344: Abortable Mixed Collections for G1
sjohanss
parents:
52716
diff
changeset
|
445 |
G1ScanRSForRegionClosure cl(_scan_state, &scan_cl, pss, G1GCPhaseTimes::ScanRS, worker_i); |
49806 | 446 |
_g1h->collection_set_iterate_from(&cl, worker_i); |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
447 |
|
46571
c70b36f0730d
8178148: Log more detailed information about scan rs phase
tschatzl
parents:
46520
diff
changeset
|
448 |
G1GCPhaseTimes* p = _g1p->phase_times(); |
1374 | 449 |
|
50113 | 450 |
p->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, cl.rem_set_root_scan_time().seconds()); |
451 |
p->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, cl.rem_set_trim_partially_time().seconds()); |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
452 |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
453 |
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
|
454 |
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
|
455 |
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
|
456 |
|
50113 | 457 |
p->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, cl.strong_code_root_scan_time().seconds()); |
458 |
p->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, cl.strong_code_root_trim_partially_time().seconds()); |
|
1374 | 459 |
} |
460 |
||
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
461 |
// Closure used for updating rem sets. Only called during an evacuation pause. |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
462 |
class G1RefineCardClosure: public G1CardTableEntryClosure { |
6247 | 463 |
G1RemSet* _g1rs; |
46572 | 464 |
G1ScanObjsDuringUpdateRSClosure* _update_rs_cl; |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
465 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
466 |
size_t _cards_scanned; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
467 |
size_t _cards_skipped; |
6247 | 468 |
public: |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
469 |
G1RefineCardClosure(G1CollectedHeap* g1h, G1ScanObjsDuringUpdateRSClosure* update_rs_cl) : |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
470 |
_g1rs(g1h->g1_rem_set()), _update_rs_cl(update_rs_cl), _cards_scanned(0), _cards_skipped(0) |
6247 | 471 |
{} |
33204
b8a3901ac5b3
8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents:
33105
diff
changeset
|
472 |
|
23855
c4574075402c
8016302: Change type of the number of GC workers to unsigned int (2)
vkempik
parents:
23455
diff
changeset
|
473 |
bool do_card_ptr(jbyte* card_ptr, uint worker_i) { |
6247 | 474 |
// The only time we care about recording cards that |
475 |
// contain references that point into the collection set |
|
476 |
// is during RSet updating within an evacuation pause. |
|
477 |
// In this case worker_i should be the id of a GC worker thread. |
|
478 |
assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
|
1374 | 479 |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
480 |
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
|
481 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
482 |
if (card_scanned) { |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
483 |
_update_rs_cl->trim_queue_partially(); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
484 |
_cards_scanned++; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
485 |
} else { |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
486 |
_cards_skipped++; |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
487 |
} |
6247 | 488 |
return true; |
489 |
} |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
490 |
|
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
491 |
size_t cards_scanned() const { return _cards_scanned; } |
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
492 |
size_t cards_skipped() const { return _cards_skipped; } |
6247 | 493 |
}; |
494 |
||
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
495 |
void G1RemSet::update_rem_set(G1ParScanThreadState* pss, uint worker_i) { |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
496 |
G1GCPhaseTimes* p = _g1p->phase_times(); |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
10000
diff
changeset
|
497 |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
498 |
// Apply closure to log entries in the HCC. |
38172
90f405aac699
8155524: HotCardCache shouldn't be part of ConcurrentG1Refine
kbarrett
parents:
38160
diff
changeset
|
499 |
if (G1HotCardCache::default_use_cache()) { |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
500 |
G1EvacPhaseTimesTracker x(p, pss, G1GCPhaseTimes::ScanHCC, worker_i); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
501 |
|
52348
21fdf8d9a8b6
8212911: Unify and micro-optimize handling of non-in-collection set references in oop closures
tschatzl
parents:
52345
diff
changeset
|
502 |
G1ScanObjsDuringUpdateRSClosure scan_hcc_cl(_g1h, pss); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
503 |
G1RefineCardClosure refine_card_cl(_g1h, &scan_hcc_cl); |
49806 | 504 |
_g1h->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
|
505 |
} |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
506 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
507 |
// Now apply the closure to all remaining log entries. |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
508 |
{ |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
509 |
G1EvacPhaseTimesTracker x(p, pss, G1GCPhaseTimes::UpdateRS, worker_i); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
510 |
|
52348
21fdf8d9a8b6
8212911: Unify and micro-optimize handling of non-in-collection set references in oop closures
tschatzl
parents:
52345
diff
changeset
|
511 |
G1ScanObjsDuringUpdateRSClosure update_rs_cl(_g1h, pss); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
512 |
G1RefineCardClosure refine_card_cl(_g1h, &update_rs_cl); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
513 |
_g1h->iterate_dirty_card_closure(&refine_card_cl, worker_i); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
514 |
|
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
515 |
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_scanned(), G1GCPhaseTimes::UpdateRSScannedCards); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
516 |
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_skipped(), G1GCPhaseTimes::UpdateRSSkippedCards); |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
517 |
} |
1374 | 518 |
} |
519 |
||
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
520 |
void G1RemSet::oops_into_collection_set_do(G1ParScanThreadState* pss, uint worker_i) { |
46670
55a3c36b64b2
8183539: Remove G1RemSet::_into_cset_dirty_card_queue_set
ehelin
parents:
46653
diff
changeset
|
521 |
update_rem_set(pss, worker_i); |
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49806
diff
changeset
|
522 |
scan_rem_set(pss, worker_i);; |
1374 | 523 |
} |
524 |
||
6958 | 525 |
void G1RemSet::prepare_for_oops_into_collection_set_do() { |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
526 |
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set(); |
1374 | 527 |
dcqs.concatenate_logs(); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
528 |
|
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
529 |
_scan_state->reset(); |
1374 | 530 |
} |
531 |
||
6958 | 532 |
void G1RemSet::cleanup_after_oops_into_collection_set_do() { |
49806 | 533 |
G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); |
38154 | 534 |
|
1374 | 535 |
// Set all cards back to clean. |
38154 | 536 |
double start = os::elapsedTime(); |
49806 | 537 |
_scan_state->clear_card_table(_g1h->workers()); |
38154 | 538 |
phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0); |
1374 | 539 |
} |
540 |
||
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
541 |
inline void check_card_ptr(jbyte* card_ptr, G1CardTable* ct) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
542 |
#ifdef ASSERT |
49806 | 543 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
544 |
assert(g1h->is_in_exact(ct->addr_for(card_ptr)), |
|
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
545 |
"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
|
546 |
p2i(card_ptr), |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
547 |
ct->index_for(ct->addr_for(card_ptr)), |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
548 |
p2i(ct->addr_for(card_ptr)), |
49806 | 549 |
g1h->addr_to_region(ct->addr_for(card_ptr))); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
550 |
#endif |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
551 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
552 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
553 |
void G1RemSet::refine_card_concurrently(jbyte* card_ptr, |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
554 |
uint worker_i) { |
49806 | 555 |
assert(!_g1h->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
|
556 |
|
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
557 |
// Construct the region representing the card. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
558 |
HeapWord* start = _ct->addr_for(card_ptr); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
559 |
// And find the region containing it. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
560 |
HeapRegion* r = _g1h->heap_region_containing_or_null(start); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
561 |
|
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
562 |
// If this is a (stale) card into an uncommitted region, exit. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
563 |
if (r == NULL) { |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
564 |
return; |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
565 |
} |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
566 |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
567 |
check_card_ptr(card_ptr, _ct); |
37988
bf4018edea5e
8153503: Move remset scan iteration claim to remset local data structure
tschatzl
parents:
37985
diff
changeset
|
568 |
|
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
569 |
// If the card is no longer dirty, nothing to do. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
570 |
if (*card_ptr != G1CardTable::dirty_card_val()) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
571 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
572 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
573 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
574 |
// 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
|
575 |
// ignore the card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
576 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
577 |
// 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
|
578 |
// 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
|
579 |
// filter them out. However, that marking is performed |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
580 |
// 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
|
581 |
// 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
|
582 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
583 |
// 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
|
584 |
// 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
|
585 |
// 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
|
586 |
// 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
|
587 |
// 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
|
588 |
// 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
|
589 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
590 |
// 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
|
591 |
// 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
|
592 |
// we see the up-to-date region type here. |
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
51332
diff
changeset
|
593 |
if (!r->is_old_or_humongous_or_archive()) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
594 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
595 |
} |
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 |
// 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
|
598 |
// * pointer to the current card |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
599 |
// (implying that the current card is not 'hot'), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
600 |
// * null |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
601 |
// (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
|
602 |
// which had some headroom), |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
603 |
// * 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
|
604 |
// |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
605 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
606 |
if (_hot_card_cache->use_cache()) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
607 |
assert(!SafepointSynchronize::is_at_safepoint(), "sanity"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
608 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
609 |
const jbyte* orig_card_ptr = card_ptr; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
610 |
card_ptr = _hot_card_cache->insert(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
611 |
if (card_ptr == NULL) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
612 |
// There was no eviction. Nothing to do. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
613 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
614 |
} else if (card_ptr != orig_card_ptr) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
615 |
// Original card was inserted and an old card was evicted. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
616 |
start = _ct->addr_for(card_ptr); |
49806 | 617 |
r = _g1h->heap_region_containing(start); |
46519
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 |
// 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
|
620 |
// ignored, as discussed earlier for the original card. The |
49346
14e84a4edb9c
8198546: [Redo] JDK-8196883 G1RemSet::refine_card_concurrently doesn't need to check for cards in collection set
tschatzl
parents:
49194
diff
changeset
|
621 |
// region could have been freed while in the cache. |
51494
1906adbef2dc
8208498: Put archive regions into a first-class HeapRegionSet
tschatzl
parents:
51332
diff
changeset
|
622 |
if (!r->is_old_or_humongous_or_archive()) { |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
623 |
return; |
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 |
} // Else we still have the original card. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
626 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
627 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
628 |
// 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
|
629 |
// 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
|
630 |
// (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
|
631 |
// beyond the end of allocation. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
632 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
633 |
// 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
|
634 |
// 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
|
635 |
// 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
|
636 |
// 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
|
637 |
// 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
|
638 |
// 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
|
639 |
// we see the up-to-date top here. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
640 |
HeapWord* scan_limit = r->top(); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
641 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
642 |
if (scan_limit <= start) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
643 |
// 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
|
644 |
return; |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
645 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
646 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
647 |
// 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
|
648 |
// 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
|
649 |
// as iteration failure. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
650 |
*const_cast<volatile jbyte*>(card_ptr) = G1CardTable::clean_card_val(); |
46519
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 |
// 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
|
653 |
// 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
|
654 |
// 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
|
655 |
// 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
|
656 |
// 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
|
657 |
// both set, in any order, to proceed. |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
658 |
OrderAccess::fence(); |
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 |
// 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
|
661 |
// a card beyond the heap. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
662 |
HeapWord* end = start + G1CardTable::card_size_in_words; |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
663 |
MemRegion dirty_region(start, MIN2(scan_limit, end)); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
664 |
assert(!dirty_region.is_empty(), "sanity"); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
665 |
|
49806 | 666 |
G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_i); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
667 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
668 |
bool card_processed = |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
669 |
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
|
670 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
671 |
// 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
|
672 |
// 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
|
673 |
// 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
|
674 |
// 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
|
675 |
// 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
|
676 |
if (!card_processed) { |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
677 |
// 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
|
678 |
// worked. (In fact, it's pretty likely.) |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
679 |
if (*card_ptr != G1CardTable::dirty_card_val()) { |
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
680 |
*card_ptr = G1CardTable::dirty_card_val(); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
681 |
MutexLockerEx x(Shared_DirtyCardQ_lock, |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
682 |
Mutex::_no_safepoint_check_flag); |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
52897
diff
changeset
|
683 |
G1DirtyCardQueue* sdcq = |
49751
c3a10df652c0
8201316: Move G1-related static members from JavaThread to G1BarrierSet
pliden
parents:
49634
diff
changeset
|
684 |
G1BarrierSet::dirty_card_queue_set().shared_dirty_card_queue(); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
685 |
sdcq->enqueue(card_ptr); |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
686 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
687 |
} else { |
46614
ae1105fff9e4
8179677: Let G1Remset::_conc_refined_cards only count number of cards concurrently refined
tschatzl
parents:
46611
diff
changeset
|
688 |
_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
|
689 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
690 |
} |
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
691 |
|
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
692 |
bool G1RemSet::refine_card_during_gc(jbyte* card_ptr, |
46572 | 693 |
G1ScanObjsDuringUpdateRSClosure* update_rs_cl) { |
49806 | 694 |
assert(_g1h->is_gc_active(), "Only call during GC"); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
695 |
|
52345
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
696 |
// Construct the region representing the card. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
697 |
HeapWord* card_start = _ct->addr_for(card_ptr); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
698 |
// And find the region containing it. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
699 |
uint const card_region_idx = _g1h->addr_to_region(card_start); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
700 |
|
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
701 |
HeapWord* scan_limit = _scan_state->scan_top(card_region_idx); |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
702 |
if (scan_limit == NULL) { |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
703 |
// This is a card into an uncommitted region. We need to bail out early as we |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
704 |
// should not access the corresponding card table entry. |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
705 |
return false; |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
706 |
} |
418fb8bb5151
8071913: Filter out entries to free/uncommitted regions during iteration
tschatzl
parents:
51877
diff
changeset
|
707 |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
708 |
check_card_ptr(card_ptr, _ct); |
46519
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
709 |
|
40c9c132f961
8177707: Specialize G1RemSet::refine_card for concurrent/during safepoint refinement
tschatzl
parents:
46518
diff
changeset
|
710 |
// 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
|
711 |
// scanned as parts of the remembered sets. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
712 |
if (*card_ptr != G1CardTable::dirty_card_val()) { |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
713 |
return false; |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
714 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
715 |
|
46676 | 716 |
// We claim lazily (so races are possible but they're benign), which reduces the |
717 |
// number of potential duplicate scans (multiple threads may enqueue the same card twice). |
|
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
718 |
*card_ptr = G1CardTable::clean_card_val() | G1CardTable::claimed_card_val(); |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
719 |
|
46676 | 720 |
_scan_state->add_dirty_region(card_region_idx); |
46520 | 721 |
if (scan_limit <= card_start) { |
722 |
// 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
|
723 |
return false; |
17327
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
724 |
} |
4bd0581aa231
7176479: G1: JVM crashes on T5-8 system with 1.5 TB heap
johnc
parents:
17108
diff
changeset
|
725 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13516
diff
changeset
|
726 |
// 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
|
727 |
// a card beyond the heap. |
49164
7e958a8ebcd3
8195142: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48969
diff
changeset
|
728 |
HeapWord* card_end = card_start + G1CardTable::card_size_in_words; |
46520 | 729 |
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
|
730 |
assert(!dirty_region.is_empty(), "sanity"); |
3590
a268fa66d7fb
6819077: G1: first GC thread coming late into the GC.
johnc
parents:
3262
diff
changeset
|
731 |
|
49806 | 732 |
HeapRegion* const card_region = _g1h->region_at(card_region_idx); |
52348
21fdf8d9a8b6
8212911: Unify and micro-optimize handling of non-in-collection set references in oop closures
tschatzl
parents:
52345
diff
changeset
|
733 |
assert(!card_region->is_young(), "Should not scan card in young region %u", card_region_idx); |
46676 | 734 |
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
|
735 |
assert(card_processed, "must be"); |
46778
f504c6f2eea5
8183121: Add information about scanned and skipped cards during UpdateRS
tschatzl
parents:
46701
diff
changeset
|
736 |
return true; |
1374 | 737 |
} |
738 |
||
35061 | 739 |
void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) { |
740 |
if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) && |
|
741 |
(period_count % G1SummarizeRSetStatsPeriod == 0)) { |
|
742 |
||
46652
ab8716d193bb
8183226: Remembered set summarization accesses not fully initialized java thread DCQS
tschatzl
parents:
46635
diff
changeset
|
743 |
G1RemSetSummary current(this); |
35061 | 744 |
_prev_period_summary.subtract_from(¤t); |
1374 | 745 |
|
37242 | 746 |
Log(gc, remset) log; |
35061 | 747 |
log.trace("%s", header); |
748 |
ResourceMark rm; |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
749 |
LogStream ls(log.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
750 |
_prev_period_summary.print_on(&ls); |
35061 | 751 |
|
752 |
_prev_period_summary.set(¤t); |
|
753 |
} |
|
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
754 |
} |
2881 | 755 |
|
6958 | 756 |
void G1RemSet::print_summary_info() { |
37242 | 757 |
Log(gc, remset, exit) log; |
35061 | 758 |
if (log.is_trace()) { |
759 |
log.trace(" Cumulative RS summary"); |
|
46653 | 760 |
G1RemSetSummary current(this); |
35061 | 761 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
762 |
LogStream ls(log.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46676
diff
changeset
|
763 |
current.print_on(&ls); |
17854
d65bc1546091
8013895: G1: G1SummarizeRSetStats output on Linux needs improvemen
tschatzl
parents:
17327
diff
changeset
|
764 |
} |
1374 | 765 |
} |
6247 | 766 |
|
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
767 |
class G1RebuildRemSetTask: public AbstractGangTask { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
768 |
// Aggregate the counting data that was constructed concurrently |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
769 |
// with marking. |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
770 |
class G1RebuildRemSetHeapRegionClosure : public HeapRegionClosure { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
771 |
G1ConcurrentMark* _cm; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
772 |
G1RebuildRemSetClosure _update_cl; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
773 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
774 |
// Applies _update_cl to the references of the given object, limiting objArrays |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
775 |
// to the given MemRegion. Returns the amount of words actually scanned. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
776 |
size_t scan_for_references(oop const obj, MemRegion mr) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
777 |
size_t const obj_size = obj->size(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
778 |
// All non-objArrays and objArrays completely within the mr |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
779 |
// can be scanned without passing the mr. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
780 |
if (!obj->is_objArray() || mr.contains(MemRegion((HeapWord*)obj, obj_size))) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
781 |
obj->oop_iterate(&_update_cl); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
782 |
return obj_size; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
783 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
784 |
// This path is for objArrays crossing the given MemRegion. Only scan the |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
785 |
// area within the MemRegion. |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
786 |
obj->oop_iterate(&_update_cl, mr); |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
787 |
return mr.intersection(MemRegion((HeapWord*)obj, obj_size)).word_size(); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
788 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
789 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
790 |
// A humongous object is live (with respect to the scanning) either |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
791 |
// a) it is marked on the bitmap as such |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
792 |
// b) its TARS is larger than TAMS, i.e. has been allocated during marking. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
793 |
bool is_humongous_live(oop const humongous_obj, const G1CMBitMap* const bitmap, HeapWord* tams, HeapWord* tars) const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
794 |
return bitmap->is_marked(humongous_obj) || (tars > tams); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
795 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
796 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
797 |
// Iterator over the live objects within the given MemRegion. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
798 |
class LiveObjIterator : public StackObj { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
799 |
const G1CMBitMap* const _bitmap; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
800 |
const HeapWord* _tams; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
801 |
const MemRegion _mr; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
802 |
HeapWord* _current; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
803 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
804 |
bool is_below_tams() const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
805 |
return _current < _tams; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
806 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
807 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
808 |
bool is_live(HeapWord* obj) const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
809 |
return !is_below_tams() || _bitmap->is_marked(obj); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
810 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
811 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
812 |
HeapWord* bitmap_limit() const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
813 |
return MIN2(const_cast<HeapWord*>(_tams), _mr.end()); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
814 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
815 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
816 |
void move_if_below_tams() { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
817 |
if (is_below_tams() && has_next()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
818 |
_current = _bitmap->get_next_marked_addr(_current, bitmap_limit()); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
819 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
820 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
821 |
public: |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
822 |
LiveObjIterator(const G1CMBitMap* const bitmap, const HeapWord* tams, const MemRegion mr, HeapWord* first_oop_into_mr) : |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
823 |
_bitmap(bitmap), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
824 |
_tams(tams), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
825 |
_mr(mr), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
826 |
_current(first_oop_into_mr) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
827 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
828 |
assert(_current <= _mr.start(), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
829 |
"First oop " PTR_FORMAT " should extend into mr [" PTR_FORMAT ", " PTR_FORMAT ")", |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
830 |
p2i(first_oop_into_mr), p2i(mr.start()), p2i(mr.end())); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
831 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
832 |
// Step to the next live object within the MemRegion if needed. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
833 |
if (is_live(_current)) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
834 |
// Non-objArrays were scanned by the previous part of that region. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
835 |
if (_current < mr.start() && !oop(_current)->is_objArray()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
836 |
_current += oop(_current)->size(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
837 |
// We might have positioned _current on a non-live object. Reposition to the next |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
838 |
// live one if needed. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
839 |
move_if_below_tams(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
840 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
841 |
} else { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
842 |
// The object at _current can only be dead if below TAMS, so we can use the bitmap. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
843 |
// immediately. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
844 |
_current = _bitmap->get_next_marked_addr(_current, bitmap_limit()); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
845 |
assert(_current == _mr.end() || is_live(_current), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
846 |
"Current " PTR_FORMAT " should be live (%s) or beyond the end of the MemRegion (" PTR_FORMAT ")", |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
847 |
p2i(_current), BOOL_TO_STR(is_live(_current)), p2i(_mr.end())); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
848 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
849 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
850 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
851 |
void move_to_next() { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
852 |
_current += next()->size(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
853 |
move_if_below_tams(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
854 |
} |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
855 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
856 |
oop next() const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
857 |
oop result = oop(_current); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
858 |
assert(is_live(_current), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
859 |
"Object " PTR_FORMAT " must be live TAMS " PTR_FORMAT " below %d mr " PTR_FORMAT " " PTR_FORMAT " outside %d", |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
860 |
p2i(_current), p2i(_tams), _tams > _current, p2i(_mr.start()), p2i(_mr.end()), _mr.contains(result)); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
861 |
return result; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
862 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
863 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
864 |
bool has_next() const { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
865 |
return _current < _mr.end(); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
866 |
} |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
867 |
}; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
868 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
869 |
// Rebuild remembered sets in the part of the region specified by mr and hr. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
870 |
// Objects between the bottom of the region and the TAMS are checked for liveness |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
871 |
// using the given bitmap. Objects between TAMS and TARS are assumed to be live. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
872 |
// Returns the number of live words between bottom and TAMS. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
873 |
size_t rebuild_rem_set_in_region(const G1CMBitMap* const bitmap, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
874 |
HeapWord* const top_at_mark_start, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
875 |
HeapWord* const top_at_rebuild_start, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
876 |
HeapRegion* hr, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
877 |
MemRegion mr) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
878 |
size_t marked_words = 0; |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
879 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
880 |
if (hr->is_humongous()) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
881 |
oop const humongous_obj = oop(hr->humongous_start_region()->bottom()); |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
882 |
if (is_humongous_live(humongous_obj, bitmap, top_at_mark_start, top_at_rebuild_start)) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
883 |
// We need to scan both [bottom, TAMS) and [TAMS, top_at_rebuild_start); |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
884 |
// however in case of humongous objects it is sufficient to scan the encompassing |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
885 |
// area (top_at_rebuild_start is always larger or equal to TAMS) as one of the |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
886 |
// two areas will be zero sized. I.e. TAMS is either |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
887 |
// the same as bottom or top(_at_rebuild_start). There is no way TAMS has a different |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
888 |
// value: this would mean that TAMS points somewhere into the object. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
889 |
assert(hr->top() == top_at_mark_start || hr->top() == top_at_rebuild_start, |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
890 |
"More than one object in the humongous region?"); |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
891 |
humongous_obj->oop_iterate(&_update_cl, mr); |
49803 | 892 |
return top_at_mark_start != hr->bottom() ? mr.intersection(MemRegion((HeapWord*)humongous_obj, humongous_obj->size())).byte_size() : 0; |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
893 |
} else { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
894 |
return 0; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
895 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
896 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
897 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
898 |
for (LiveObjIterator it(bitmap, top_at_mark_start, mr, hr->block_start(mr.start())); it.has_next(); it.move_to_next()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
899 |
oop obj = it.next(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
900 |
size_t scanned_size = scan_for_references(obj, mr); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
901 |
if ((HeapWord*)obj < top_at_mark_start) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
902 |
marked_words += scanned_size; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
903 |
} |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
904 |
} |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
905 |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
906 |
return marked_words * HeapWordSize; |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
907 |
} |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
908 |
public: |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
909 |
G1RebuildRemSetHeapRegionClosure(G1CollectedHeap* g1h, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
910 |
G1ConcurrentMark* cm, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
911 |
uint worker_id) : |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
912 |
HeapRegionClosure(), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
913 |
_cm(cm), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
914 |
_update_cl(g1h, worker_id) { } |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
915 |
|
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
916 |
bool do_heap_region(HeapRegion* hr) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
917 |
if (_cm->has_aborted()) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
918 |
return true; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
919 |
} |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
920 |
|
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
921 |
uint const region_idx = hr->hrm_index(); |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
922 |
DEBUG_ONLY(HeapWord* const top_at_rebuild_start_check = _cm->top_at_rebuild_start(region_idx);) |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
923 |
assert(top_at_rebuild_start_check == NULL || |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
924 |
top_at_rebuild_start_check > hr->bottom(), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
925 |
"A TARS (" PTR_FORMAT ") == bottom() (" PTR_FORMAT ") indicates the old region %u is empty (%s)", |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
926 |
p2i(top_at_rebuild_start_check), p2i(hr->bottom()), region_idx, hr->get_type_str()); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
927 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
928 |
size_t total_marked_bytes = 0; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
929 |
size_t const chunk_size_in_words = G1RebuildRemSetChunkSize / HeapWordSize; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
930 |
|
49803 | 931 |
HeapWord* const top_at_mark_start = hr->prev_top_at_mark_start(); |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
932 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
933 |
HeapWord* cur = hr->bottom(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
934 |
while (cur < hr->end()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
935 |
// After every iteration (yield point) we need to check whether the region's |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
936 |
// TARS changed due to e.g. eager reclaim. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
937 |
HeapWord* const top_at_rebuild_start = _cm->top_at_rebuild_start(region_idx); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
938 |
if (top_at_rebuild_start == NULL) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
939 |
return false; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
940 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
941 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
942 |
MemRegion next_chunk = MemRegion(hr->bottom(), top_at_rebuild_start).intersection(MemRegion(cur, chunk_size_in_words)); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
943 |
if (next_chunk.is_empty()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
944 |
break; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
945 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
946 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
947 |
const Ticks start = Ticks::now(); |
49803 | 948 |
size_t marked_bytes = rebuild_rem_set_in_region(_cm->prev_mark_bitmap(), |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
949 |
top_at_mark_start, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
950 |
top_at_rebuild_start, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
951 |
hr, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
952 |
next_chunk); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
953 |
Tickspan time = Ticks::now() - start; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
954 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
955 |
log_trace(gc, remset, tracking)("Rebuilt region %u " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
956 |
"live " SIZE_FORMAT " " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
957 |
"time %.3fms " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
958 |
"marked bytes " SIZE_FORMAT " " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
959 |
"bot " PTR_FORMAT " " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
960 |
"TAMS " PTR_FORMAT " " |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
961 |
"TARS " PTR_FORMAT, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
962 |
region_idx, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
963 |
_cm->liveness(region_idx) * HeapWordSize, |
50113 | 964 |
time.seconds() * 1000.0, |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
965 |
marked_bytes, |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
966 |
p2i(hr->bottom()), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
967 |
p2i(top_at_mark_start), |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
968 |
p2i(top_at_rebuild_start)); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
969 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
970 |
if (marked_bytes > 0) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
971 |
total_marked_bytes += marked_bytes; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
972 |
} |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
973 |
cur += chunk_size_in_words; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
974 |
|
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
975 |
_cm->do_yield_check(); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
976 |
if (_cm->has_aborted()) { |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
977 |
return true; |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
978 |
} |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
979 |
} |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
980 |
// In the final iteration of the loop the region might have been eagerly reclaimed. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
981 |
// Simply filter out those regions. We can not just use region type because there |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
982 |
// might have already been new allocations into these regions. |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
983 |
DEBUG_ONLY(HeapWord* const top_at_rebuild_start = _cm->top_at_rebuild_start(region_idx);) |
49803 | 984 |
assert(top_at_rebuild_start == NULL || |
985 |
total_marked_bytes == hr->marked_bytes(), |
|
986 |
"Marked bytes " SIZE_FORMAT " for region %u (%s) in [bottom, TAMS) do not match calculated marked bytes " SIZE_FORMAT " " |
|
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
987 |
"(" PTR_FORMAT " " PTR_FORMAT " " PTR_FORMAT ")", |
49803 | 988 |
total_marked_bytes, hr->hrm_index(), hr->get_type_str(), hr->marked_bytes(), |
49634
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
989 |
p2i(hr->bottom()), p2i(top_at_mark_start), p2i(top_at_rebuild_start)); |
df9dcfff6628
8197932: Better split work in rebuild remembered sets phase
tschatzl
parents:
49632
diff
changeset
|
990 |
// Abort state may have changed after the yield check. |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
991 |
return _cm->has_aborted(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
992 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
993 |
}; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
994 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
995 |
HeapRegionClaimer _hr_claimer; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
996 |
G1ConcurrentMark* _cm; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
997 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
998 |
uint _worker_id_offset; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
999 |
public: |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1000 |
G1RebuildRemSetTask(G1ConcurrentMark* cm, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1001 |
uint n_workers, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1002 |
uint worker_id_offset) : |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1003 |
AbstractGangTask("G1 Rebuild Remembered Set"), |
51332 | 1004 |
_hr_claimer(n_workers), |
49607
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1005 |
_cm(cm), |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1006 |
_worker_id_offset(worker_id_offset) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1007 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1008 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1009 |
void work(uint worker_id) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1010 |
SuspendibleThreadSetJoiner sts_join; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1011 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1012 |
G1CollectedHeap* g1h = G1CollectedHeap::heap(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1013 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1014 |
G1RebuildRemSetHeapRegionClosure cl(g1h, _cm, _worker_id_offset + worker_id); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1015 |
g1h->heap_region_par_iterate_from_worker_offset(&cl, &_hr_claimer, worker_id); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1016 |
} |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1017 |
}; |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1018 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1019 |
void G1RemSet::rebuild_rem_set(G1ConcurrentMark* cm, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1020 |
WorkGang* workers, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1021 |
uint worker_id_offset) { |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1022 |
uint num_workers = workers->active_workers(); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1023 |
|
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1024 |
G1RebuildRemSetTask cl(cm, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1025 |
num_workers, |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1026 |
worker_id_offset); |
acffe6ff3ae7
8180415: Rebuild remembered sets during the concurrent cycle
tschatzl
parents:
49347
diff
changeset
|
1027 |
workers->run_task(&cl, num_workers); |
37414
2672ba9af0dc
8151386: Extract card live data out of G1ConcurrentMark
tschatzl
parents:
37248
diff
changeset
|
1028 |
} |