author | tschatzl |
Fri, 26 Feb 2016 13:02:30 +0100 | |
changeset 36369 | f4c151403480 |
parent 35492 | c8c0273e6b91 |
child 37985 | 539c597ee0fa |
permissions | -rw-r--r-- |
25482 | 1 |
/* |
36369
f4c151403480
8150629: Initializing all ParScanThreadStates causes significant unaccounted "Other" times
tschatzl
parents:
35492
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
25482 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP |
26 |
#define SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP |
|
25482 | 27 |
|
30764 | 28 |
#include "gc/g1/dirtyCardQueue.hpp" |
29 |
#include "gc/g1/g1CollectedHeap.hpp" |
|
30 |
#include "gc/g1/g1CollectorPolicy.hpp" |
|
31 |
#include "gc/g1/g1OopClosures.hpp" |
|
32 |
#include "gc/g1/g1RemSet.hpp" |
|
33 |
#include "gc/g1/g1SATBCardTableModRefBS.hpp" |
|
34 |
#include "gc/shared/ageTable.hpp" |
|
25482 | 35 |
#include "memory/allocation.hpp" |
36 |
#include "oops/oop.hpp" |
|
37 |
||
32378
8dd0e7359751
8133470: Uses of Atomic methods in plab.hpp should be moved to .inline.hpp file
tschatzl
parents:
32377
diff
changeset
|
38 |
class G1PLABAllocator; |
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
33105
diff
changeset
|
39 |
class G1EvacuationRootClosures; |
25482 | 40 |
class HeapRegion; |
41 |
class outputStream; |
|
42 |
||
32381
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
43 |
class G1ParScanThreadState : public CHeapObj<mtGC> { |
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
44 |
private: |
25482 | 45 |
G1CollectedHeap* _g1h; |
46 |
RefToScanQueue* _refs; |
|
47 |
DirtyCardQueue _dcq; |
|
48 |
G1SATBCardTableModRefBS* _ct_bs; |
|
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
33105
diff
changeset
|
49 |
G1EvacuationRootClosures* _closures; |
25482 | 50 |
|
32185
49a57ff2c3cb
8073052: Rename and clean up the allocation manager hierarchy in g1Allocator.?pp
tschatzl
parents:
31976
diff
changeset
|
51 |
G1PLABAllocator* _plab_allocator; |
25482 | 52 |
|
35492
c8c0273e6b91
8146690: Make all classes in GC follow the naming convention.
david
parents:
35051
diff
changeset
|
53 |
AgeTable _age_table; |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
54 |
InCSetState _dest[InCSetState::Num]; |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
55 |
// Local tenuring threshold. |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
56 |
uint _tenuring_threshold; |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
57 |
G1ParScanClosure _scanner; |
25482 | 58 |
|
59 |
int _hash_seed; |
|
32187
0891f3fa84fc
8133047: Rename G1ParScanThreadState::_queue_num to _worker_id
tschatzl
parents:
32186
diff
changeset
|
60 |
uint _worker_id; |
25482 | 61 |
|
62 |
// Map from young-age-index (0 == not young, 1 is youngest) to |
|
63 |
// surviving words. base is what we get back from the malloc call |
|
64 |
size_t* _surviving_young_words_base; |
|
65 |
// this points into the array, as we use the first few entries for padding |
|
66 |
size_t* _surviving_young_words; |
|
67 |
||
32377
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
68 |
// Indicates whether in the last generation (old) there is no more space |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
69 |
// available for allocation. |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
70 |
bool _old_gen_is_full; |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
71 |
|
25482 | 72 |
#define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t)) |
73 |
||
74 |
DirtyCardQueue& dirty_card_queue() { return _dcq; } |
|
75 |
G1SATBCardTableModRefBS* ctbs() { return _ct_bs; } |
|
76 |
||
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
77 |
InCSetState dest(InCSetState original) const { |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
78 |
assert(original.is_valid(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32737
diff
changeset
|
79 |
"Original state invalid: " CSETSTATE_FORMAT, original.value()); |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
80 |
assert(_dest[original.value()].is_valid_gen(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32737
diff
changeset
|
81 |
"Dest state is invalid: " CSETSTATE_FORMAT, _dest[original.value()].value()); |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
82 |
return _dest[original.value()]; |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
83 |
} |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
84 |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
85 |
public: |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
86 |
G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length); |
34131
d5fc001452bb
8139883: Add virtual destructor G1ParScanThreadState
ehelin
parents:
33224
diff
changeset
|
87 |
virtual ~G1ParScanThreadState(); |
25482 | 88 |
|
32381
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
89 |
void set_ref_processor(ReferenceProcessor* rp) { _scanner.set_ref_processor(rp); } |
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
90 |
|
25482 | 91 |
#ifdef ASSERT |
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
92 |
bool queue_is_empty() const { return _refs->is_empty(); } |
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
93 |
|
25482 | 94 |
bool verify_ref(narrowOop* ref) const; |
95 |
bool verify_ref(oop* ref) const; |
|
96 |
bool verify_task(StarTask ref) const; |
|
97 |
#endif // ASSERT |
|
98 |
||
35051
002d874a4284
8144714: Add extension point to G1 evacuation closures
mgerdin
parents:
34617
diff
changeset
|
99 |
template <class T> void do_oop_ext(T* ref); |
30566
18eb9aa972d0
8076177: Remove usage of stack.inline.hpp functions from taskqueue.hpp
stefank
parents:
28213
diff
changeset
|
100 |
template <class T> void push_on_queue(T* ref); |
25482 | 101 |
|
34616
421a6405ca30
8144067: Pass obj directly to G1ParScanThreadState::update_rs
ehelin
parents:
34615
diff
changeset
|
102 |
template <class T> void update_rs(HeapRegion* from, T* p, oop o) { |
26701
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
103 |
// If the new value of the field points to the same region or |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
104 |
// is the to-space, we don't need to include it in the Rset updates. |
34617
943740ea0d17
8144072: G1ParScanThreadState::update_rs does not need to call is_in_reserved
ehelin
parents:
34616
diff
changeset
|
105 |
if (!HeapRegion::is_in_same_region(p, o) && !from->is_young()) { |
26701
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
106 |
size_t card_index = ctbs()->index_for(p); |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
107 |
// If the card hasn't been added to the buffer, do it. |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
108 |
if (ctbs()->mark_card_deferred(card_index)) { |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
109 |
dirty_card_queue().enqueue((jbyte*)ctbs()->byte_for_index(card_index)); |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
110 |
} |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
111 |
} |
f8ff74a6c058
8052172: Evacuation failure handling in G1 does not evacuate all objects if -XX:-G1DeferredRSUpdate is set
tschatzl
parents:
25483
diff
changeset
|
112 |
} |
25482 | 113 |
|
33213
b937f634f56e
8138762: Refactor setup of evacuation closures in G1
mgerdin
parents:
33105
diff
changeset
|
114 |
G1EvacuationRootClosures* closures() { return _closures; } |
32187
0891f3fa84fc
8133047: Rename G1ParScanThreadState::_queue_num to _worker_id
tschatzl
parents:
32186
diff
changeset
|
115 |
uint worker_id() { return _worker_id; } |
25482 | 116 |
|
32381
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
117 |
// Returns the current amount of waste due to alignment or not being able to fit |
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
118 |
// objects within LABs and the undo waste. |
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
119 |
virtual void waste(size_t& wasted, size_t& undo_wasted); |
25482 | 120 |
|
121 |
size_t* surviving_young_words() { |
|
32381
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
122 |
// We add one to hide entry 0 which accumulates surviving words for |
25482 | 123 |
// age -1 regions (i.e. non-young ones) |
32381
b750fd963056
8040162: Avoid reallocating PLABs between GC phases in G1
tschatzl
parents:
32378
diff
changeset
|
124 |
return _surviving_young_words + 1; |
25482 | 125 |
} |
126 |
||
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
127 |
void flush(size_t* surviving_young_words); |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
128 |
|
25482 | 129 |
private: |
130 |
#define G1_PARTIAL_ARRAY_MASK 0x2 |
|
131 |
||
132 |
inline bool has_partial_array_mask(oop* ref) const { |
|
133 |
return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK; |
|
134 |
} |
|
135 |
||
136 |
// We never encode partial array oops as narrowOop*, so return false immediately. |
|
137 |
// This allows the compiler to create optimized code when popping references from |
|
138 |
// the work queue. |
|
139 |
inline bool has_partial_array_mask(narrowOop* ref) const { |
|
140 |
assert(((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) != G1_PARTIAL_ARRAY_MASK, "Partial array oop reference encoded as narrowOop*"); |
|
141 |
return false; |
|
142 |
} |
|
143 |
||
144 |
// Only implement set_partial_array_mask() for regular oops, not for narrowOops. |
|
145 |
// We always encode partial arrays as regular oop, to allow the |
|
146 |
// specialization for has_partial_array_mask() for narrowOops above. |
|
147 |
// This means that unintentional use of this method with narrowOops are caught |
|
148 |
// by the compiler. |
|
149 |
inline oop* set_partial_array_mask(oop obj) const { |
|
150 |
assert(((uintptr_t)(void *)obj & G1_PARTIAL_ARRAY_MASK) == 0, "Information loss!"); |
|
151 |
return (oop*) ((uintptr_t)(void *)obj | G1_PARTIAL_ARRAY_MASK); |
|
152 |
} |
|
153 |
||
154 |
inline oop clear_partial_array_mask(oop* ref) const { |
|
155 |
return cast_to_oop((intptr_t)ref & ~G1_PARTIAL_ARRAY_MASK); |
|
156 |
} |
|
157 |
||
158 |
inline void do_oop_partial_array(oop* p); |
|
159 |
||
160 |
// This method is applied to the fields of the objects that have just been copied. |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
161 |
template <class T> inline void do_oop_evac(T* p, HeapRegion* from); |
25482 | 162 |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
163 |
template <class T> inline void deal_with_reference(T* ref_to_scan); |
25482 | 164 |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
165 |
inline void dispatch_reference(StarTask ref); |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
166 |
|
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
167 |
// Tries to allocate word_sz in the PLAB of the next "generation" after trying to |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
168 |
// allocate into dest. State is the original (source) cset state for the object |
32377
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
169 |
// that is allocated for. Previous_plab_refill_failed indicates whether previously |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
170 |
// a PLAB refill into "state" failed. |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
171 |
// Returns a non-NULL pointer if successful, and updates dest if required. |
32377
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
172 |
// Also determines whether we should continue to try to allocate into the various |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
173 |
// generations or just end trying to allocate. |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
174 |
HeapWord* allocate_in_next_plab(InCSetState const state, |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
175 |
InCSetState* dest, |
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
176 |
size_t word_sz, |
32377
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
177 |
AllocationContext_t const context, |
5ee15c417d02
8003237: G1: Reduce unnecessary (and failing) allocation attempts when handling an evacuation failure
tschatzl
parents:
32187
diff
changeset
|
178 |
bool previous_plab_refill_failed); |
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
179 |
|
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
180 |
inline InCSetState next_state(InCSetState const state, markOop const m, uint& age); |
32608 | 181 |
|
182 |
void report_promotion_event(InCSetState const dest_state, |
|
183 |
oop const old, size_t word_sz, uint age, |
|
184 |
HeapWord * const obj_ptr, const AllocationContext_t context) const; |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
185 |
public: |
25482 | 186 |
|
28213
b0bf57cd1e9d
8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
tschatzl
parents:
27682
diff
changeset
|
187 |
oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark); |
25482 | 188 |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
189 |
void trim_queue(); |
25482 | 190 |
|
25483
962ccf95c515
8035401: Fix visibility of G1ParScanThreadState members
tschatzl
parents:
25482
diff
changeset
|
191 |
inline void steal_and_trim_queue(RefToScanQueueSet *task_queues); |
31976
da45f85bf4e1
8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents:
30764
diff
changeset
|
192 |
|
da45f85bf4e1
8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents:
30764
diff
changeset
|
193 |
// An attempt to evacuate "obj" has failed; take necessary steps. |
da45f85bf4e1
8004687: G1: Parallelize object self-forwarding and scanning during an evacuation failure
tschatzl
parents:
30764
diff
changeset
|
194 |
oop handle_evacuation_failure_par(oop obj, markOop m); |
25482 | 195 |
}; |
196 |
||
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
197 |
class G1ParScanThreadStateSet : public StackObj { |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
198 |
G1CollectedHeap* _g1h; |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
199 |
G1ParScanThreadState** _states; |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
200 |
size_t* _surviving_young_words_total; |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
201 |
size_t* _cards_scanned; |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
202 |
size_t _total_cards_scanned; |
36369
f4c151403480
8150629: Initializing all ParScanThreadStates causes significant unaccounted "Other" times
tschatzl
parents:
35492
diff
changeset
|
203 |
size_t _young_cset_length; |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
204 |
uint _n_workers; |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
205 |
bool _flushed; |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
206 |
|
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
207 |
public: |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
208 |
G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) : |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
209 |
_g1h(g1h), |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
210 |
_states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)), |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
211 |
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)), |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
212 |
_cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)), |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
213 |
_total_cards_scanned(0), |
36369
f4c151403480
8150629: Initializing all ParScanThreadStates causes significant unaccounted "Other" times
tschatzl
parents:
35492
diff
changeset
|
214 |
_young_cset_length(young_cset_length), |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
215 |
_n_workers(n_workers), |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
216 |
_flushed(false) { |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
217 |
for (uint i = 0; i < n_workers; ++i) { |
36369
f4c151403480
8150629: Initializing all ParScanThreadStates causes significant unaccounted "Other" times
tschatzl
parents:
35492
diff
changeset
|
218 |
_states[i] = NULL; |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
219 |
} |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
220 |
memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t)); |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
221 |
memset(_cards_scanned, 0, n_workers * sizeof(size_t)); |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
222 |
} |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
223 |
|
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
224 |
~G1ParScanThreadStateSet() { |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
225 |
assert(_flushed, "thread local state from the per thread states should have been flushed"); |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
226 |
FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states); |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
227 |
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total); |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
228 |
FREE_C_HEAP_ARRAY(size_t, _cards_scanned); |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
229 |
} |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
230 |
|
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
231 |
void flush(); |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
232 |
|
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
233 |
G1ParScanThreadState* state_for_worker(uint worker_id); |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
234 |
|
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
235 |
void add_cards_scanned(uint worker_id, size_t cards_scanned); |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
236 |
size_t total_cards_scanned() const; |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
237 |
const size_t* surviving_young_words() const; |
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
238 |
|
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
239 |
private: |
32737
f02118695c2f
8135154: Move cards scanned and surviving young words aggregation to G1ParScanThreadStateSet
mgerdin
parents:
32736
diff
changeset
|
240 |
G1ParScanThreadState* new_par_scan_state(uint worker_id, size_t young_cset_length); |
32736
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
241 |
}; |
755024a84282
8135152: Create a G1ParScanThreadStateSet class for managing G1 GC per thread states
mgerdin
parents:
32608
diff
changeset
|
242 |
|
30764 | 243 |
#endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP |