author | jwilhelm |
Thu, 03 Oct 2013 21:36:29 +0200 | |
changeset 20398 | b206c580c45f |
parent 16670 | 4af09aff4237 |
child 22234 | da823d78ad65 |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
13963
e5b53c306fb5
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
13195
diff
changeset
|
2 |
* Copyright (c) 2001, 2012, 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" |
26 |
#include "gc_implementation/g1/ptrQueue.hpp" |
|
27 |
#include "memory/allocation.hpp" |
|
28 |
#include "memory/allocation.inline.hpp" |
|
29 |
#include "runtime/mutex.hpp" |
|
30 |
#include "runtime/mutexLocker.hpp" |
|
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
13963
diff
changeset
|
31 |
#include "runtime/thread.inline.hpp" |
1374 | 32 |
|
7920 | 33 |
PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) : |
34 |
_qset(qset), _buf(NULL), _index(0), _active(active), |
|
1374 | 35 |
_perm(perm), _lock(NULL) |
36 |
{} |
|
37 |
||
1560
1b328492b7f8
6770608: G1: Mutator thread can flush barrier and satb queues during safepoint
iveresov
parents:
1374
diff
changeset
|
38 |
void PtrQueue::flush() { |
1374 | 39 |
if (!_perm && _buf != NULL) { |
40 |
if (_index == _sz) { |
|
41 |
// No work to do. |
|
42 |
qset()->deallocate_buffer(_buf); |
|
43 |
} else { |
|
44 |
// We must NULL out the unused entries, then enqueue. |
|
45 |
for (size_t i = 0; i < _index; i += oopSize) { |
|
46 |
_buf[byte_index_to_index((int)i)] = NULL; |
|
47 |
} |
|
48 |
qset()->enqueue_complete_buffer(_buf); |
|
49 |
} |
|
1560
1b328492b7f8
6770608: G1: Mutator thread can flush barrier and satb queues during safepoint
iveresov
parents:
1374
diff
changeset
|
50 |
_buf = NULL; |
1b328492b7f8
6770608: G1: Mutator thread can flush barrier and satb queues during safepoint
iveresov
parents:
1374
diff
changeset
|
51 |
_index = 0; |
1374 | 52 |
} |
53 |
} |
|
54 |
||
55 |
||
56 |
void PtrQueue::enqueue_known_active(void* ptr) { |
|
57 |
assert(0 <= _index && _index <= _sz, "Invariant."); |
|
58 |
assert(_index == 0 || _buf != NULL, "invariant"); |
|
59 |
||
60 |
while (_index == 0) { |
|
61 |
handle_zero_index(); |
|
62 |
} |
|
4481 | 63 |
|
1374 | 64 |
assert(_index > 0, "postcondition"); |
65 |
_index -= oopSize; |
|
66 |
_buf[byte_index_to_index((int)_index)] = ptr; |
|
67 |
assert(0 <= _index && _index <= _sz, "Invariant."); |
|
68 |
} |
|
69 |
||
70 |
void PtrQueue::locking_enqueue_completed_buffer(void** buf) { |
|
71 |
assert(_lock->owned_by_self(), "Required."); |
|
4640
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
72 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
73 |
// We have to unlock _lock (which may be Shared_DirtyCardQ_lock) before |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
74 |
// we acquire DirtyCardQ_CBL_mon inside enqeue_complete_buffer as they |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
75 |
// have the same rank and we may get the "possible deadlock" message |
1374 | 76 |
_lock->unlock(); |
4640
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
77 |
|
1374 | 78 |
qset()->enqueue_complete_buffer(buf); |
79 |
// We must relock only because the caller will unlock, for the normal |
|
80 |
// case. |
|
81 |
_lock->lock_without_safepoint_check(); |
|
82 |
} |
|
83 |
||
84 |
||
85 |
PtrQueueSet::PtrQueueSet(bool notify_when_complete) : |
|
86 |
_max_completed_queue(0), |
|
87 |
_cbl_mon(NULL), _fl_lock(NULL), |
|
88 |
_notify_when_complete(notify_when_complete), |
|
89 |
_sz(0), |
|
90 |
_completed_buffers_head(NULL), |
|
91 |
_completed_buffers_tail(NULL), |
|
92 |
_n_completed_buffers(0), |
|
93 |
_process_completed_threshold(0), _process_completed(false), |
|
94 |
_buf_free_list(NULL), _buf_free_list_sz(0) |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
95 |
{ |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
96 |
_fl_owner = this; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
97 |
} |
1374 | 98 |
|
99 |
void** PtrQueueSet::allocate_buffer() { |
|
100 |
assert(_sz > 0, "Didn't set a buffer size."); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
101 |
MutexLockerEx x(_fl_owner->_fl_lock, Mutex::_no_safepoint_check_flag); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
102 |
if (_fl_owner->_buf_free_list != NULL) { |
4481 | 103 |
void** res = BufferNode::make_buffer_from_node(_fl_owner->_buf_free_list); |
104 |
_fl_owner->_buf_free_list = _fl_owner->_buf_free_list->next(); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
105 |
_fl_owner->_buf_free_list_sz--; |
1374 | 106 |
return res; |
107 |
} else { |
|
4481 | 108 |
// Allocate space for the BufferNode in front of the buffer. |
13195 | 109 |
char *b = NEW_C_HEAP_ARRAY(char, _sz + BufferNode::aligned_size(), mtGC); |
4481 | 110 |
return BufferNode::make_buffer_from_block(b); |
1374 | 111 |
} |
112 |
} |
|
113 |
||
114 |
void PtrQueueSet::deallocate_buffer(void** buf) { |
|
115 |
assert(_sz > 0, "Didn't set a buffer size."); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
116 |
MutexLockerEx x(_fl_owner->_fl_lock, Mutex::_no_safepoint_check_flag); |
4481 | 117 |
BufferNode *node = BufferNode::make_node_from_buffer(buf); |
118 |
node->set_next(_fl_owner->_buf_free_list); |
|
119 |
_fl_owner->_buf_free_list = node; |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
120 |
_fl_owner->_buf_free_list_sz++; |
1374 | 121 |
} |
122 |
||
123 |
void PtrQueueSet::reduce_free_list() { |
|
4481 | 124 |
assert(_fl_owner == this, "Free list reduction is allowed only for the owner"); |
1374 | 125 |
// For now we'll adopt the strategy of deleting half. |
126 |
MutexLockerEx x(_fl_lock, Mutex::_no_safepoint_check_flag); |
|
127 |
size_t n = _buf_free_list_sz / 2; |
|
128 |
while (n > 0) { |
|
129 |
assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); |
|
4481 | 130 |
void* b = BufferNode::make_block_from_node(_buf_free_list); |
131 |
_buf_free_list = _buf_free_list->next(); |
|
13195 | 132 |
FREE_C_HEAP_ARRAY(char, b, mtGC); |
4454
d27c981064b4
6895788: G1: SATB and update buffer allocation code allocates too much space
johnc
parents:
3261
diff
changeset
|
133 |
_buf_free_list_sz --; |
1374 | 134 |
n--; |
135 |
} |
|
136 |
} |
|
137 |
||
4481 | 138 |
void PtrQueue::handle_zero_index() { |
7920 | 139 |
assert(_index == 0, "Precondition."); |
140 |
||
4481 | 141 |
// This thread records the full buffer and allocates a new one (while |
142 |
// holding the lock if there is one). |
|
143 |
if (_buf != NULL) { |
|
7920 | 144 |
if (!should_enqueue_buffer()) { |
145 |
assert(_index > 0, "the buffer can only be re-used if it's not full"); |
|
146 |
return; |
|
147 |
} |
|
148 |
||
4481 | 149 |
if (_lock) { |
4640
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
150 |
assert(_lock->owned_by_self(), "Required."); |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
151 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
152 |
// The current PtrQ may be the shared dirty card queue and |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
153 |
// may be being manipulated by more than one worker thread |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
154 |
// during a pause. Since the enqueuing of the completed |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
155 |
// buffer unlocks the Shared_DirtyCardQ_lock more than one |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
156 |
// worker thread can 'race' on reading the shared queue attributes |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
157 |
// (_buf and _index) and multiple threads can call into this |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
158 |
// routine for the same buffer. This will cause the completed |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
159 |
// buffer to be added to the CBL multiple times. |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
160 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
161 |
// We "claim" the current buffer by caching value of _buf in |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
162 |
// a local and clearing the field while holding _lock. When |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
163 |
// _lock is released (while enqueueing the completed buffer) |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
164 |
// the thread that acquires _lock will skip this code, |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
165 |
// preventing the subsequent the multiple enqueue, and |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
166 |
// install a newly allocated buffer below. |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
167 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
168 |
void** buf = _buf; // local pointer to completed buffer |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
169 |
_buf = NULL; // clear shared _buf field |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
170 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
171 |
locking_enqueue_completed_buffer(buf); // enqueue completed buffer |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
172 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
173 |
// While the current thread was enqueuing the buffer another thread |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
174 |
// may have a allocated a new buffer and inserted it into this pointer |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
175 |
// queue. If that happens then we just return so that the current |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
176 |
// thread doesn't overwrite the buffer allocated by the other thread |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
177 |
// and potentially losing some dirtied cards. |
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
178 |
|
b5edb9b319e4
6915005: G1: Hang in PtrQueueSet::completed_buffers_list_length with gcl001
johnc
parents:
4481
diff
changeset
|
179 |
if (_buf != NULL) return; |
4481 | 180 |
} else { |
181 |
if (qset()->process_or_enqueue_complete_buffer(_buf)) { |
|
182 |
// Recycle the buffer. No allocation. |
|
183 |
_sz = qset()->buffer_size(); |
|
184 |
_index = _sz; |
|
185 |
return; |
|
186 |
} |
|
187 |
} |
|
188 |
} |
|
189 |
// Reallocate the buffer |
|
190 |
_buf = qset()->allocate_buffer(); |
|
191 |
_sz = qset()->buffer_size(); |
|
192 |
_index = _sz; |
|
193 |
assert(0 <= _index && _index <= _sz, "Invariant."); |
|
194 |
} |
|
1374 | 195 |
|
4481 | 196 |
bool PtrQueueSet::process_or_enqueue_complete_buffer(void** buf) { |
197 |
if (Thread::current()->is_Java_thread()) { |
|
198 |
// We don't lock. It is fine to be epsilon-precise here. |
|
199 |
if (_max_completed_queue == 0 || _max_completed_queue > 0 && |
|
200 |
_n_completed_buffers >= _max_completed_queue + _completed_queue_padding) { |
|
201 |
bool b = mut_process_buffer(buf); |
|
202 |
if (b) { |
|
203 |
// True here means that the buffer hasn't been deallocated and the caller may reuse it. |
|
204 |
return true; |
|
205 |
} |
|
1374 | 206 |
} |
4481 | 207 |
} |
208 |
// The buffer will be enqueued. The caller will have to get a new one. |
|
209 |
enqueue_complete_buffer(buf); |
|
210 |
return false; |
|
211 |
} |
|
1374 | 212 |
|
4481 | 213 |
void PtrQueueSet::enqueue_complete_buffer(void** buf, size_t index) { |
214 |
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); |
|
215 |
BufferNode* cbn = BufferNode::new_from_buffer(buf); |
|
216 |
cbn->set_index(index); |
|
1374 | 217 |
if (_completed_buffers_tail == NULL) { |
218 |
assert(_completed_buffers_head == NULL, "Well-formedness"); |
|
219 |
_completed_buffers_head = cbn; |
|
220 |
_completed_buffers_tail = cbn; |
|
221 |
} else { |
|
4481 | 222 |
_completed_buffers_tail->set_next(cbn); |
1374 | 223 |
_completed_buffers_tail = cbn; |
224 |
} |
|
225 |
_n_completed_buffers++; |
|
226 |
||
4481 | 227 |
if (!_process_completed && _process_completed_threshold >= 0 && |
2881 | 228 |
_n_completed_buffers >= _process_completed_threshold) { |
1374 | 229 |
_process_completed = true; |
230 |
if (_notify_when_complete) |
|
4481 | 231 |
_cbl_mon->notify(); |
1374 | 232 |
} |
233 |
debug_only(assert_completed_buffer_list_len_correct_locked()); |
|
234 |
} |
|
235 |
||
236 |
int PtrQueueSet::completed_buffers_list_length() { |
|
237 |
int n = 0; |
|
4481 | 238 |
BufferNode* cbn = _completed_buffers_head; |
1374 | 239 |
while (cbn != NULL) { |
240 |
n++; |
|
4481 | 241 |
cbn = cbn->next(); |
1374 | 242 |
} |
243 |
return n; |
|
244 |
} |
|
245 |
||
246 |
void PtrQueueSet::assert_completed_buffer_list_len_correct() { |
|
247 |
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); |
|
248 |
assert_completed_buffer_list_len_correct_locked(); |
|
249 |
} |
|
250 |
||
251 |
void PtrQueueSet::assert_completed_buffer_list_len_correct_locked() { |
|
4481 | 252 |
guarantee(completed_buffers_list_length() == _n_completed_buffers, |
1374 | 253 |
"Completed buffer length is wrong."); |
254 |
} |
|
255 |
||
256 |
void PtrQueueSet::set_buffer_size(size_t sz) { |
|
257 |
assert(_sz == 0 && sz > 0, "Should be called only once."); |
|
258 |
_sz = sz * oopSize; |
|
259 |
} |
|
260 |
||
4481 | 261 |
// Merge lists of buffers. Notify the processing threads. |
262 |
// The source queue is emptied as a result. The queues |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
263 |
// must share the monitor. |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
264 |
void PtrQueueSet::merge_bufferlists(PtrQueueSet *src) { |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
265 |
assert(_cbl_mon == src->_cbl_mon, "Should share the same lock"); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
266 |
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
267 |
if (_completed_buffers_tail == NULL) { |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
268 |
assert(_completed_buffers_head == NULL, "Well-formedness"); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
269 |
_completed_buffers_head = src->_completed_buffers_head; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
270 |
_completed_buffers_tail = src->_completed_buffers_tail; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
271 |
} else { |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
272 |
assert(_completed_buffers_head != NULL, "Well formedness"); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
273 |
if (src->_completed_buffers_head != NULL) { |
4481 | 274 |
_completed_buffers_tail->set_next(src->_completed_buffers_head); |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
275 |
_completed_buffers_tail = src->_completed_buffers_tail; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
276 |
} |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
277 |
} |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
278 |
_n_completed_buffers += src->_n_completed_buffers; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
279 |
|
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
280 |
src->_n_completed_buffers = 0; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
281 |
src->_completed_buffers_head = NULL; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
282 |
src->_completed_buffers_tail = NULL; |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
283 |
|
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
284 |
assert(_completed_buffers_head == NULL && _completed_buffers_tail == NULL || |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
285 |
_completed_buffers_head != NULL && _completed_buffers_tail != NULL, |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
286 |
"Sanity"); |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
287 |
} |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
288 |
|
4481 | 289 |
void PtrQueueSet::notify_if_necessary() { |
290 |
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); |
|
291 |
if (_n_completed_buffers >= _process_completed_threshold || _max_completed_queue == 0) { |
|
292 |
_process_completed = true; |
|
293 |
if (_notify_when_complete) |
|
294 |
_cbl_mon->notify(); |
|
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
295 |
} |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
1623
diff
changeset
|
296 |
} |