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