author | tschatzl |
Wed, 13 Mar 2019 21:01:56 +0100 | |
changeset 54110 | f4f0dce5d0bb |
parent 54006 | a421bdf22394 |
child 54255 | c81fbf340ceb |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
53482 | 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:
4481
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4481
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:
4481
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
27 |
#include "gc/g1/g1DirtyCardQueue.hpp" |
53482 | 28 |
#include "gc/g1/g1FreeIdSet.hpp" |
46653 | 29 |
#include "gc/g1/g1RemSet.hpp" |
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49333
diff
changeset
|
30 |
#include "gc/g1/g1ThreadLocalData.hpp" |
30764 | 31 |
#include "gc/g1/heapRegionRemSet.hpp" |
52576
367ca5f32505
8213829: Remove circular dependency between g1CollectedHeap and g1ConcurrentMark
manc
parents:
49752
diff
changeset
|
32 |
#include "gc/shared/suspendibleThreadSet.hpp" |
30764 | 33 |
#include "gc/shared/workgroup.hpp" |
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
40012
diff
changeset
|
34 |
#include "runtime/atomic.hpp" |
52726
9cfa2e273b77
8214278: Cleanup process_completed_threshold and related state
kbarrett
parents:
52684
diff
changeset
|
35 |
#include "runtime/flags/flagSetting.hpp" |
7397 | 36 |
#include "runtime/mutexLocker.hpp" |
37 |
#include "runtime/safepoint.hpp" |
|
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
10565
diff
changeset
|
38 |
#include "runtime/thread.inline.hpp" |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47634
diff
changeset
|
39 |
#include "runtime/threadSMR.hpp" |
1374 | 40 |
|
46653 | 41 |
// Closure used for updating remembered sets and recording references that |
42 |
// point into the collection set while the mutator is running. |
|
43 |
// Assumed to be only executed concurrently with the mutator. Yields via |
|
44 |
// SuspendibleThreadSet after every card. |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
45 |
class G1RefineCardConcurrentlyClosure: public G1CardTableEntryClosure { |
46653 | 46 |
public: |
54110 | 47 |
bool do_card_ptr(CardValue* card_ptr, uint worker_i) { |
53985
0da5c17f5e43
8219747: Remove g1_ prefix to g1_remset and g1_policy members in G1CollectedHeap
tschatzl
parents:
53747
diff
changeset
|
48 |
G1CollectedHeap::heap()->rem_set()->refine_card_concurrently(card_ptr, worker_i); |
46653 | 49 |
|
50 |
if (SuspendibleThreadSet::should_yield()) { |
|
51 |
// Caller will actually yield. |
|
52 |
return false; |
|
53 |
} |
|
54 |
// Otherwise, we finished successfully; return true. |
|
55 |
return true; |
|
56 |
} |
|
57 |
}; |
|
58 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
59 |
G1DirtyCardQueue::G1DirtyCardQueue(G1DirtyCardQueueSet* qset, bool permanent) : |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
60 |
// Dirty card queues are always active, so we create them with their |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
61 |
// active field set to true. |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
62 |
PtrQueue(qset, permanent, true /* active */) |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
63 |
{ } |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
64 |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
65 |
G1DirtyCardQueue::~G1DirtyCardQueue() { |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
66 |
if (!is_permanent()) { |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
67 |
flush(); |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
68 |
} |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
69 |
} |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
70 |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
71 |
G1DirtyCardQueueSet::G1DirtyCardQueueSet(bool notify_when_complete) : |
4481 | 72 |
PtrQueueSet(notify_when_complete), |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
73 |
_shared_dirty_card_queue(this, true /* permanent */), |
1374 | 74 |
_free_ids(NULL), |
53034
de99beff5c0e
8214946: G1: Initialize all class members on construction
lkorinth
parents:
52726
diff
changeset
|
75 |
_processed_buffers_mut(0), |
de99beff5c0e
8214946: G1: Initialize all class members on construction
lkorinth
parents:
52726
diff
changeset
|
76 |
_processed_buffers_rs_thread(0), |
de99beff5c0e
8214946: G1: Initialize all class members on construction
lkorinth
parents:
52726
diff
changeset
|
77 |
_cur_par_buffer_node(NULL) |
1374 | 78 |
{ |
79 |
_all_active = true; |
|
80 |
} |
|
81 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
82 |
G1DirtyCardQueueSet::~G1DirtyCardQueueSet() { |
53482 | 83 |
delete _free_ids; |
84 |
} |
|
85 |
||
2882
d508a8bac491
6841831: G1: assert(contains_reference(from),"We just added it!") fires
iveresov
parents:
2881
diff
changeset
|
86 |
// Determines how many mutator threads can process the buffers in parallel. |
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
87 |
uint G1DirtyCardQueueSet::num_par_ids() { |
40012
f69cfe79fe98
8161993: G1 crashes if active_processor_count changes during startup
tschatzl
parents:
37197
diff
changeset
|
88 |
return (uint)os::initial_active_processor_count(); |
1374 | 89 |
} |
90 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
91 |
void G1DirtyCardQueueSet::initialize(Monitor* cbl_mon, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
92 |
BufferNode::Allocator* allocator, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
93 |
Mutex* lock, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
94 |
bool init_free_ids) { |
52726
9cfa2e273b77
8214278: Cleanup process_completed_threshold and related state
kbarrett
parents:
52684
diff
changeset
|
95 |
PtrQueueSet::initialize(cbl_mon, allocator); |
1374 | 96 |
_shared_dirty_card_queue.set_lock(lock); |
35465 | 97 |
if (init_free_ids) { |
53482 | 98 |
_free_ids = new G1FreeIdSet(0, num_par_ids()); |
35465 | 99 |
} |
1374 | 100 |
} |
101 |
||
54006 | 102 |
void G1DirtyCardQueueSet::handle_zero_index_for_thread(Thread* t) { |
49752
93d84f667d12
8201318: Introduce GCThreadLocalData to abstract GC-specific data belonging to a thread
pliden
parents:
49333
diff
changeset
|
103 |
G1ThreadLocalData::dirty_card_queue(t).handle_zero_index(); |
1374 | 104 |
} |
105 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
106 |
bool G1DirtyCardQueueSet::apply_closure_to_buffer(G1CardTableEntryClosure* cl, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
107 |
BufferNode* node, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
108 |
bool consume, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
109 |
uint worker_i) { |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
110 |
if (cl == NULL) return true; |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
111 |
bool result = true; |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
112 |
void** buf = BufferNode::make_buffer_from_node(node); |
46443 | 113 |
size_t i = node->index(); |
114 |
size_t limit = buffer_size(); |
|
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
115 |
for ( ; i < limit; ++i) { |
54110 | 116 |
CardTable::CardValue* card_ptr = static_cast<CardTable::CardValue*>(buf[i]); |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
117 |
assert(card_ptr != NULL, "invariant"); |
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
118 |
if (!cl->do_card_ptr(card_ptr, worker_i)) { |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
119 |
result = false; // Incomplete processing. |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
120 |
break; |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
121 |
} |
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
122 |
} |
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
123 |
if (consume) { |
46443 | 124 |
assert(i <= buffer_size(), "invariant"); |
125 |
node->set_index(i); |
|
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
126 |
} |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
127 |
return result; |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
128 |
} |
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
129 |
|
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
130 |
#ifndef ASSERT |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
131 |
#define assert_fully_consumed(node, buffer_size) |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
132 |
#else |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
133 |
#define assert_fully_consumed(node, buffer_size) \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
134 |
do { \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
135 |
size_t _afc_index = (node)->index(); \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
136 |
size_t _afc_size = (buffer_size); \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
137 |
assert(_afc_index == _afc_size, \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
138 |
"Buffer was not fully consumed as claimed: index: " \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
139 |
SIZE_FORMAT ", size: " SIZE_FORMAT, \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
140 |
_afc_index, _afc_size); \ |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
141 |
} while (0) |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
142 |
#endif // ASSERT |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
143 |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
144 |
bool G1DirtyCardQueueSet::mut_process_buffer(BufferNode* node) { |
35465 | 145 |
guarantee(_free_ids != NULL, "must be"); |
1374 | 146 |
|
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
147 |
uint worker_i = _free_ids->claim_par_id(); // temporarily claim an id |
46653 | 148 |
G1RefineCardConcurrentlyClosure cl; |
149 |
bool result = apply_closure_to_buffer(&cl, node, true, worker_i); |
|
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
150 |
_free_ids->release_par_id(worker_i); // release the id |
1374 | 151 |
|
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
152 |
if (result) { |
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
153 |
assert_fully_consumed(node, buffer_size()); |
35481
53825bdb41a0
8145038: Simplify mut_process_buffer worker id management
aharlap
parents:
35465
diff
changeset
|
154 |
Atomic::inc(&_processed_buffers_mut); |
1374 | 155 |
} |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
156 |
return result; |
1374 | 157 |
} |
158 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
159 |
bool G1DirtyCardQueueSet::refine_completed_buffer_concurrently(uint worker_i, size_t stop_at) { |
46653 | 160 |
G1RefineCardConcurrentlyClosure cl; |
161 |
return apply_closure_to_completed_buffer(&cl, worker_i, stop_at, false); |
|
162 |
} |
|
163 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
164 |
bool G1DirtyCardQueueSet::apply_closure_during_gc(G1CardTableEntryClosure* cl, uint worker_i) { |
49333
489f1dd40582
8196876: OopStorage::assert_at_safepoint clashes with assert_at_safepoint macros in g1CollectedHeap.hpp
kbarrett
parents:
48105
diff
changeset
|
165 |
assert_at_safepoint(); |
46653 | 166 |
return apply_closure_to_completed_buffer(cl, worker_i, 0, true); |
167 |
} |
|
168 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
169 |
bool G1DirtyCardQueueSet::apply_closure_to_completed_buffer(G1CardTableEntryClosure* cl, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
170 |
uint worker_i, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
171 |
size_t stop_at, |
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
172 |
bool during_pause) { |
6247 | 173 |
assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause"); |
174 |
BufferNode* nd = get_completed_buffer(stop_at); |
|
36179
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
175 |
if (nd == NULL) { |
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
176 |
return false; |
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
177 |
} else { |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
178 |
if (apply_closure_to_buffer(cl, nd, true, worker_i)) { |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
179 |
assert_fully_consumed(nd, buffer_size()); |
36179
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
180 |
// Done with fully processed buffer. |
37065 | 181 |
deallocate_buffer(nd); |
36179
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
182 |
Atomic::inc(&_processed_buffers_rs_thread); |
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
183 |
} else { |
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
184 |
// Return partially processed buffer to the queue. |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
185 |
guarantee(!during_pause, "Should never stop early"); |
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
53034
diff
changeset
|
186 |
enqueue_completed_buffer(nd); |
36179
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
187 |
} |
37197
282fa21230c3
8151670: Unexpected concurrent refinement deactivation and reactivation
kbarrett
parents:
37112
diff
changeset
|
188 |
return true; |
36179
03a0d7b8450f
8149793: DirtyCardQueueSet::apply_closure_to_completed_buffer_helper isn't helpful
kbarrett
parents:
35902
diff
changeset
|
189 |
} |
6247 | 190 |
} |
191 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
192 |
void G1DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(G1CardTableEntryClosure* cl) { |
24104
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
193 |
BufferNode* nd = _cur_par_buffer_node; |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
194 |
while (nd != NULL) { |
37065 | 195 |
BufferNode* next = nd->next(); |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
196 |
BufferNode* actual = Atomic::cmpxchg(next, &_cur_par_buffer_node, nd); |
24104
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
197 |
if (actual == nd) { |
37112
fe72d1d082ff
8151781: DirtyCardQueue::apply_closure is unused
kbarrett
parents:
37065
diff
changeset
|
198 |
bool b = apply_closure_to_buffer(cl, nd, false); |
24104
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
199 |
guarantee(b, "Should not stop early."); |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
200 |
nd = next; |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
201 |
} else { |
47634
6a0c42c40cd1
8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents:
47216
diff
changeset
|
202 |
nd = actual; |
24104
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
203 |
} |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
204 |
} |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
205 |
} |
febf9363fb68
8019342: G1: High "Other" time most likely due to card redirtying
tschatzl
parents:
23855
diff
changeset
|
206 |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
207 |
void G1DirtyCardQueueSet::abandon_logs() { |
6247 | 208 |
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); |
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
53034
diff
changeset
|
209 |
abandon_completed_buffers(); |
54006 | 210 |
|
1374 | 211 |
// Since abandon is done only at safepoints, we can safely manipulate |
212 |
// these queues. |
|
54006 | 213 |
struct AbandonThreadLogClosure : public ThreadClosure { |
214 |
virtual void do_thread(Thread* t) { |
|
215 |
G1ThreadLocalData::dirty_card_queue(t).reset(); |
|
216 |
} |
|
217 |
} closure; |
|
218 |
Threads::threads_do(&closure); |
|
219 |
||
1374 | 220 |
shared_dirty_card_queue()->reset(); |
221 |
} |
|
222 |
||
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
223 |
void G1DirtyCardQueueSet::concatenate_log(G1DirtyCardQueue& dcq) { |
37065 | 224 |
if (!dcq.is_empty()) { |
46305
bff6d23aa1e3
8175221: Cleanup DirtyCardQueueSet::concatenate_log
kbarrett
parents:
40655
diff
changeset
|
225 |
dcq.flush(); |
37065 | 226 |
} |
227 |
} |
|
1374 | 228 |
|
53747
13acc8e38a29
8218089: Rename DirtyCardQueue et al to follow usual G1 naming conventions
kbarrett
parents:
53482
diff
changeset
|
229 |
void G1DirtyCardQueueSet::concatenate_logs() { |
1374 | 230 |
// Iterate over all the threads, if we find a partial log add it to |
231 |
// the global list of logs. Temporarily turn off the limit on the number |
|
232 |
// of outstanding buffers. |
|
233 |
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); |
|
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
53034
diff
changeset
|
234 |
size_t old_limit = max_completed_buffers(); |
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
53034
diff
changeset
|
235 |
set_max_completed_buffers(MaxCompletedBuffersUnlimited); |
54006 | 236 |
|
237 |
class ConcatenateThreadLogClosure : public ThreadClosure { |
|
238 |
G1DirtyCardQueueSet* _qset; |
|
239 |
public: |
|
240 |
ConcatenateThreadLogClosure(G1DirtyCardQueueSet* qset) : _qset(qset) {} |
|
241 |
virtual void do_thread(Thread* t) { |
|
242 |
_qset->concatenate_log(G1ThreadLocalData::dirty_card_queue(t)); |
|
243 |
} |
|
244 |
} closure(this); |
|
245 |
Threads::threads_do(&closure); |
|
246 |
||
37065 | 247 |
concatenate_log(_shared_dirty_card_queue); |
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
53034
diff
changeset
|
248 |
set_max_completed_buffers(old_limit); |
1374 | 249 |
} |