author | coleenp |
Thu, 25 Apr 2019 10:56:31 -0400 | |
changeset 54623 | 1126f0607c70 |
parent 54366 | 2b48cedce327 |
child 54713 | 040bf087ae39 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
54006 | 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:
5082
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5082
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:
5082
diff
changeset
|
21 |
* questions. |
1374 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
51441
2e91d927e00c
8154343: Make SATB related code available to other GCs
kbarrett
parents:
51403
diff
changeset
|
26 |
#include "gc/shared/satbMarkQueue.hpp" |
30764 | 27 |
#include "gc/shared/collectedHeap.hpp" |
51393
cc8d309cd05a
8209345: Merge SATBMarkQueueFilter into SATBMarkQueueSet
kbarrett
parents:
51368
diff
changeset
|
28 |
#include "logging/log.hpp" |
7397 | 29 |
#include "memory/allocation.inline.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
30 |
#include "oops/oop.inline.hpp" |
7397 | 31 |
#include "runtime/mutexLocker.hpp" |
51403
0f3bfea3acf1
8209347: SATBMarkQueue.cpp should not need jvm.h
kbarrett
parents:
51401
diff
changeset
|
32 |
#include "runtime/os.hpp" |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
33 |
#include "runtime/safepoint.hpp" |
7397 | 34 |
#include "runtime/thread.hpp" |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47765
diff
changeset
|
35 |
#include "runtime/threadSMR.hpp" |
10670
4ea0e7d2ffbc
6484982: G1: process references during evacuation pauses
johnc
parents:
7920
diff
changeset
|
36 |
#include "runtime/vmThread.hpp" |
1374 | 37 |
|
54255 | 38 |
SATBMarkQueue::SATBMarkQueue(SATBMarkQueueSet* qset) : |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
39 |
// SATB queues are only active during marking cycles. We create |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
40 |
// them with their active field set to false. If a thread is |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
41 |
// created during a cycle and its SATB queue needs to be activated |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
42 |
// before the thread starts running, we'll need to set its active |
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
43 |
// field to true. This must be done in the collector-specific |
54006 | 44 |
// BarrierSet thread attachment protocol. |
54255 | 45 |
PtrQueue(qset, false /* active */) |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
46 |
{ } |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
33105
diff
changeset
|
47 |
|
33792 | 48 |
void SATBMarkQueue::flush() { |
30255
f43e306ec51e
8075466: SATB queue pre-filter verify found reclaimed humongous object
kbarrett
parents:
30154
diff
changeset
|
49 |
// Filter now to possibly save work later. If filtering empties the |
f43e306ec51e
8075466: SATB queue pre-filter verify found reclaimed humongous object
kbarrett
parents:
30154
diff
changeset
|
50 |
// buffer then flush_impl can deallocate the buffer. |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
51 |
filter(); |
28507 | 52 |
flush_impl(); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
53 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
54 |
|
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
49752
diff
changeset
|
55 |
// This method will first apply filtering to the buffer. If filtering |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
49752
diff
changeset
|
56 |
// retains a small enough collection in the buffer, we can continue to |
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
49752
diff
changeset
|
57 |
// use the buffer as-is, instead of enqueueing and replacing it. |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
58 |
|
33792 | 59 |
bool SATBMarkQueue::should_enqueue_buffer() { |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
60 |
// This method should only be called if there is a non-NULL buffer |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
61 |
// that is full. |
46443 | 62 |
assert(index() == 0, "pre-condition"); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
63 |
assert(_buf != NULL, "pre-condition"); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
64 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
65 |
filter(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
66 |
|
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
67 |
SATBMarkQueueSet* satb_qset = static_cast<SATBMarkQueueSet*>(qset()); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
68 |
size_t threshold = satb_qset->buffer_enqueue_threshold(); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
69 |
// Ensure we'll enqueue completely full buffers. |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
70 |
assert(threshold > 0, "enqueue threshold = 0"); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
71 |
// Ensure we won't enqueue empty buffers. |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
72 |
assert(threshold <= capacity(), |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
73 |
"enqueue threshold " SIZE_FORMAT " exceeds capacity " SIZE_FORMAT, |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
74 |
threshold, capacity()); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
75 |
return index() < threshold; |
7920 | 76 |
} |
77 |
||
33792 | 78 |
void SATBMarkQueue::apply_closure_and_empty(SATBBufferClosure* cl) { |
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
79 |
assert(SafepointSynchronize::is_at_safepoint(), |
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
80 |
"SATB queues must only be processed at safepoints"); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
81 |
if (_buf != NULL) { |
46443 | 82 |
cl->do_buffer(&_buf[index()], size()); |
83 |
reset(); |
|
1374 | 84 |
} |
85 |
} |
|
86 |
||
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
87 |
#ifndef PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
88 |
// Helpful for debugging |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
89 |
|
46443 | 90 |
static void print_satb_buffer(const char* name, |
91 |
void** buf, |
|
92 |
size_t index, |
|
93 |
size_t capacity) { |
|
94 |
tty->print_cr(" SATB BUFFER [%s] buf: " PTR_FORMAT " index: " SIZE_FORMAT |
|
95 |
" capacity: " SIZE_FORMAT, |
|
96 |
name, p2i(buf), index, capacity); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
97 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
98 |
|
46443 | 99 |
void SATBMarkQueue::print(const char* name) { |
100 |
print_satb_buffer(name, _buf, index(), capacity()); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
101 |
} |
46443 | 102 |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
103 |
#endif // PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
104 |
|
1374 | 105 |
SATBMarkQueueSet::SATBMarkQueueSet() : |
30268
d28a9aa10804
8078021: SATB apply_closure_to_completed_buffer should have closure argument
kbarrett
parents:
30255
diff
changeset
|
106 |
PtrQueueSet(), |
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
107 |
_buffer_enqueue_threshold(0) |
51278
d56dd9798d54
8208611: Refactor SATBMarkQueue filtering to allow GC-specific filters
kbarrett
parents:
49752
diff
changeset
|
108 |
{} |
1374 | 109 |
|
52582
6df094be7f58
8213352: Separate BufferNode allocation from PtrQueueSet
kbarrett
parents:
51441
diff
changeset
|
110 |
void SATBMarkQueueSet::initialize(Monitor* cbl_mon, |
6df094be7f58
8213352: Separate BufferNode allocation from PtrQueueSet
kbarrett
parents:
51441
diff
changeset
|
111 |
BufferNode::Allocator* allocator, |
52726
9cfa2e273b77
8214278: Cleanup process_completed_threshold and related state
kbarrett
parents:
52582
diff
changeset
|
112 |
size_t process_completed_buffers_threshold, |
54006 | 113 |
uint buffer_enqueue_threshold_percentage) { |
52726
9cfa2e273b77
8214278: Cleanup process_completed_threshold and related state
kbarrett
parents:
52582
diff
changeset
|
114 |
PtrQueueSet::initialize(cbl_mon, allocator); |
9cfa2e273b77
8214278: Cleanup process_completed_threshold and related state
kbarrett
parents:
52582
diff
changeset
|
115 |
set_process_completed_buffers_threshold(process_completed_buffers_threshold); |
51401
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
116 |
assert(buffer_size() != 0, "buffer size not initialized"); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
117 |
// Minimum threshold of 1 ensures enqueuing of completely full buffers. |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
118 |
size_t size = buffer_size(); |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
119 |
size_t enqueue_qty = (size * buffer_enqueue_threshold_percentage) / 100; |
58113ce90caf
8209346: Refactor SATBMarkQueue filter configuration
kbarrett
parents:
51393
diff
changeset
|
120 |
_buffer_enqueue_threshold = MAX2(size - enqueue_qty, (size_t)1); |
1374 | 121 |
} |
122 |
||
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
123 |
#ifdef ASSERT |
22497 | 124 |
void SATBMarkQueueSet::dump_active_states(bool expected_active) { |
36090
cffc1dd98258
8149541: Use log_error() instead of log_info() when verification reports a problem
brutisso
parents:
35061
diff
changeset
|
125 |
log_error(gc, verify)("Expected SATB active state: %s", expected_active ? "ACTIVE" : "INACTIVE"); |
cffc1dd98258
8149541: Use log_error() instead of log_info() when verification reports a problem
brutisso
parents:
35061
diff
changeset
|
126 |
log_error(gc, verify)("Actual SATB active states:"); |
cffc1dd98258
8149541: Use log_error() instead of log_info() when verification reports a problem
brutisso
parents:
35061
diff
changeset
|
127 |
log_error(gc, verify)(" Queue set: %s", is_active() ? "ACTIVE" : "INACTIVE"); |
54006 | 128 |
|
129 |
class DumpThreadStateClosure : public ThreadClosure { |
|
130 |
SATBMarkQueueSet* _qset; |
|
131 |
public: |
|
132 |
DumpThreadStateClosure(SATBMarkQueueSet* qset) : _qset(qset) {} |
|
133 |
virtual void do_thread(Thread* t) { |
|
134 |
SATBMarkQueue& queue = _qset->satb_queue_for_thread(t); |
|
135 |
log_error(gc, verify)(" Thread \"%s\" queue: %s", |
|
136 |
t->name(), |
|
137 |
queue.is_active() ? "ACTIVE" : "INACTIVE"); |
|
138 |
} |
|
139 |
} closure(this); |
|
140 |
Threads::threads_do(&closure); |
|
22497 | 141 |
} |
142 |
||
143 |
void SATBMarkQueueSet::verify_active_states(bool expected_active) { |
|
144 |
// Verify queue set state |
|
145 |
if (is_active() != expected_active) { |
|
146 |
dump_active_states(expected_active); |
|
54006 | 147 |
fatal("SATB queue set has an unexpected active state"); |
22497 | 148 |
} |
149 |
||
150 |
// Verify thread queue states |
|
54006 | 151 |
class VerifyThreadStatesClosure : public ThreadClosure { |
152 |
SATBMarkQueueSet* _qset; |
|
153 |
bool _expected_active; |
|
154 |
public: |
|
155 |
VerifyThreadStatesClosure(SATBMarkQueueSet* qset, bool expected_active) : |
|
156 |
_qset(qset), _expected_active(expected_active) {} |
|
157 |
virtual void do_thread(Thread* t) { |
|
158 |
if (_qset->satb_queue_for_thread(t).is_active() != _expected_active) { |
|
159 |
_qset->dump_active_states(_expected_active); |
|
160 |
fatal("Thread SATB queue has an unexpected active state"); |
|
161 |
} |
|
22497 | 162 |
} |
54006 | 163 |
} closure(this, expected_active); |
164 |
Threads::threads_do(&closure); |
|
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
165 |
} |
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
166 |
#endif // ASSERT |
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
167 |
|
22497 | 168 |
void SATBMarkQueueSet::set_active_all_threads(bool active, bool expected_active) { |
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
169 |
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); |
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
170 |
#ifdef ASSERT |
22497 | 171 |
verify_active_states(expected_active); |
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
172 |
#endif // ASSERT |
54366
2b48cedce327
8220671: Initialization race for non-JavaThread PtrQueues
kbarrett
parents:
54255
diff
changeset
|
173 |
// Update the global state, synchronized with threads list management. |
2b48cedce327
8220671: Initialization race for non-JavaThread PtrQueues
kbarrett
parents:
54255
diff
changeset
|
174 |
{ |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
54366
diff
changeset
|
175 |
MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag); |
54366
2b48cedce327
8220671: Initialization race for non-JavaThread PtrQueues
kbarrett
parents:
54255
diff
changeset
|
176 |
_all_active = active; |
2b48cedce327
8220671: Initialization race for non-JavaThread PtrQueues
kbarrett
parents:
54255
diff
changeset
|
177 |
} |
54006 | 178 |
|
179 |
class SetThreadActiveClosure : public ThreadClosure { |
|
180 |
SATBMarkQueueSet* _qset; |
|
181 |
bool _active; |
|
182 |
public: |
|
183 |
SetThreadActiveClosure(SATBMarkQueueSet* qset, bool active) : |
|
184 |
_qset(qset), _active(active) {} |
|
185 |
virtual void do_thread(Thread* t) { |
|
186 |
_qset->satb_queue_for_thread(t).set_active(_active); |
|
187 |
} |
|
188 |
} closure(this, active); |
|
189 |
Threads::threads_do(&closure); |
|
1374 | 190 |
} |
191 |
||
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
192 |
void SATBMarkQueueSet::filter_thread_buffers() { |
54006 | 193 |
class FilterThreadBufferClosure : public ThreadClosure { |
194 |
SATBMarkQueueSet* _qset; |
|
195 |
public: |
|
196 |
FilterThreadBufferClosure(SATBMarkQueueSet* qset) : _qset(qset) {} |
|
197 |
virtual void do_thread(Thread* t) { |
|
198 |
_qset->satb_queue_for_thread(t).filter(); |
|
199 |
} |
|
200 |
} closure(this); |
|
201 |
Threads::threads_do(&closure); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
202 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
203 |
|
30577
de9fa7ccc1bc
8075215: SATB buffer processing found reclaimed humongous object
kbarrett
parents:
30279
diff
changeset
|
204 |
bool SATBMarkQueueSet::apply_closure_to_completed_buffer(SATBBufferClosure* cl) { |
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
52726
diff
changeset
|
205 |
BufferNode* nd = get_completed_buffer(); |
1374 | 206 |
if (nd != NULL) { |
4481 | 207 |
void **buf = BufferNode::make_buffer_from_node(nd); |
46443 | 208 |
size_t index = nd->index(); |
209 |
size_t size = buffer_size(); |
|
37065 | 210 |
assert(index <= size, "invariant"); |
211 |
cl->do_buffer(buf + index, size - index); |
|
212 |
deallocate_buffer(nd); |
|
1374 | 213 |
return true; |
214 |
} else { |
|
215 |
return false; |
|
216 |
} |
|
217 |
} |
|
218 |
||
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
219 |
#ifndef PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
220 |
// Helpful for debugging |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
221 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
222 |
#define SATB_PRINTER_BUFFER_SIZE 256 |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
223 |
|
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
224 |
void SATBMarkQueueSet::print_all(const char* msg) { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
225 |
char buffer[SATB_PRINTER_BUFFER_SIZE]; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
226 |
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
227 |
|
35061 | 228 |
tty->cr(); |
229 |
tty->print_cr("SATB BUFFERS [%s]", msg); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
230 |
|
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
52726
diff
changeset
|
231 |
BufferNode* nd = completed_buffers_head(); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
232 |
int i = 0; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
233 |
while (nd != NULL) { |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
234 |
void** buf = BufferNode::make_buffer_from_node(nd); |
51403
0f3bfea3acf1
8209347: SATBMarkQueue.cpp should not need jvm.h
kbarrett
parents:
51401
diff
changeset
|
235 |
os::snprintf(buffer, SATB_PRINTER_BUFFER_SIZE, "Enqueued: %d", i); |
46443 | 236 |
print_satb_buffer(buffer, buf, nd->index(), buffer_size()); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
237 |
nd = nd->next(); |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
238 |
i += 1; |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
239 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
240 |
|
54006 | 241 |
class PrintThreadClosure : public ThreadClosure { |
242 |
SATBMarkQueueSet* _qset; |
|
243 |
char* _buffer; |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
244 |
|
54006 | 245 |
public: |
246 |
PrintThreadClosure(SATBMarkQueueSet* qset, char* buffer) : |
|
247 |
_qset(qset), _buffer(buffer) {} |
|
248 |
||
249 |
virtual void do_thread(Thread* t) { |
|
250 |
os::snprintf(_buffer, SATB_PRINTER_BUFFER_SIZE, "Thread: %s", t->name()); |
|
251 |
_qset->satb_queue_for_thread(t).print(_buffer); |
|
252 |
} |
|
253 |
} closure(this, buffer); |
|
254 |
Threads::threads_do(&closure); |
|
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
255 |
|
35061 | 256 |
tty->cr(); |
11455
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
257 |
} |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
258 |
#endif // PRODUCT |
a6ab3d8b9a4c
6888336: G1: avoid explicitly marking and pushing objects in survivor spaces
tonyp
parents:
10670
diff
changeset
|
259 |
|
1374 | 260 |
void SATBMarkQueueSet::abandon_partial_marking() { |
54006 | 261 |
assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); |
53102
35530ca3e0b2
8214201: Make PtrQueueSet completed buffer list private
kbarrett
parents:
52726
diff
changeset
|
262 |
abandon_completed_buffers(); |
54006 | 263 |
|
264 |
class AbandonThreadQueueClosure : public ThreadClosure { |
|
265 |
SATBMarkQueueSet* _qset; |
|
266 |
public: |
|
267 |
AbandonThreadQueueClosure(SATBMarkQueueSet* qset) : _qset(qset) {} |
|
268 |
virtual void do_thread(Thread* t) { |
|
269 |
_qset->satb_queue_for_thread(t).reset(); |
|
270 |
} |
|
271 |
} closure(this); |
|
272 |
Threads::threads_do(&closure); |
|
1374 | 273 |
} |