author | tschatzl |
Wed, 18 Apr 2018 11:36:48 +0200 | |
changeset 49806 | 2d62570a615c |
parent 49392 | 2956d0ece7a9 |
child 51332 | c25572739e7c |
permissions | -rw-r--r-- |
1374 | 1 |
/* |
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2001, 2018, 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 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_G1_PTRQUEUE_HPP |
26 |
#define SHARE_VM_GC_G1_PTRQUEUE_HPP |
|
7397 | 27 |
|
46625 | 28 |
#include "utilities/align.hpp" |
7397 | 29 |
#include "utilities/sizes.hpp" |
30 |
||
1374 | 31 |
// There are various techniques that require threads to be able to log |
32 |
// addresses. For example, a generational write barrier might log |
|
33 |
// the addresses of modified old-generation objects. This type supports |
|
34 |
// this operation. |
|
35 |
||
37065 | 36 |
class BufferNode; |
1374 | 37 |
class PtrQueueSet; |
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
38 |
class PtrQueue { |
20011
d74937287461
8024760: add more types, fields and constants to VMStructs
twisti
parents:
11455
diff
changeset
|
39 |
friend class VMStructs; |
1374 | 40 |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
41 |
// Noncopyable - not defined. |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
42 |
PtrQueue(const PtrQueue&); |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
43 |
PtrQueue& operator=(const PtrQueue&); |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
44 |
|
1374 | 45 |
// The ptr queue set to which this queue belongs. |
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
46 |
PtrQueueSet* const _qset; |
1374 | 47 |
|
48 |
// Whether updates should be logged. |
|
49 |
bool _active; |
|
50 |
||
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
51 |
// If true, the queue is permanent, and doesn't need to deallocate |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
52 |
// its buffer in the destructor (since that obtains a lock which may not |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
53 |
// be legally locked by then. |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
54 |
const bool _permanent; |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
55 |
|
46443 | 56 |
// The (byte) index at which an object was last enqueued. Starts at |
57 |
// capacity_in_bytes (indicating an empty buffer) and goes towards zero. |
|
58 |
// Value is always pointer-size aligned. |
|
59 |
size_t _index; |
|
60 |
||
61 |
// Size of the current buffer, in bytes. |
|
62 |
// Value is always pointer-size aligned. |
|
63 |
size_t _capacity_in_bytes; |
|
64 |
||
65 |
static const size_t _element_size = sizeof(void*); |
|
66 |
||
67 |
// Get the capacity, in bytes. The capacity must have been set. |
|
68 |
size_t capacity_in_bytes() const { |
|
69 |
assert(_capacity_in_bytes > 0, "capacity not set"); |
|
70 |
return _capacity_in_bytes; |
|
71 |
} |
|
72 |
||
73 |
void set_capacity(size_t entries) { |
|
74 |
size_t byte_capacity = index_to_byte_index(entries); |
|
75 |
assert(_capacity_in_bytes == 0 || _capacity_in_bytes == byte_capacity, |
|
76 |
"changing capacity " SIZE_FORMAT " -> " SIZE_FORMAT, |
|
77 |
_capacity_in_bytes, byte_capacity); |
|
78 |
_capacity_in_bytes = byte_capacity; |
|
79 |
} |
|
80 |
||
81 |
static size_t byte_index_to_index(size_t ind) { |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46443
diff
changeset
|
82 |
assert(is_aligned(ind, _element_size), "precondition"); |
46443 | 83 |
return ind / _element_size; |
84 |
} |
|
85 |
||
86 |
static size_t index_to_byte_index(size_t ind) { |
|
87 |
return ind * _element_size; |
|
88 |
} |
|
89 |
||
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
90 |
protected: |
1374 | 91 |
// The buffer. |
92 |
void** _buf; |
|
46443 | 93 |
|
94 |
size_t index() const { |
|
95 |
return byte_index_to_index(_index); |
|
96 |
} |
|
1374 | 97 |
|
46443 | 98 |
void set_index(size_t new_index) { |
99 |
size_t byte_index = index_to_byte_index(new_index); |
|
100 |
assert(byte_index <= capacity_in_bytes(), "precondition"); |
|
101 |
_index = byte_index; |
|
102 |
} |
|
103 |
||
104 |
size_t capacity() const { |
|
105 |
return byte_index_to_index(capacity_in_bytes()); |
|
106 |
} |
|
1374 | 107 |
|
108 |
// If there is a lock associated with this buffer, this is that lock. |
|
109 |
Mutex* _lock; |
|
110 |
||
111 |
PtrQueueSet* qset() { return _qset; } |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
112 |
bool is_permanent() const { return _permanent; } |
28507 | 113 |
|
46305
bff6d23aa1e3
8175221: Cleanup DirtyCardQueueSet::concatenate_log
kbarrett
parents:
37065
diff
changeset
|
114 |
// Process queue entries and release resources. |
28507 | 115 |
void flush_impl(); |
1374 | 116 |
|
117 |
// Initialize this queue to contain a null buffer, and be part of the |
|
118 |
// given PtrQueueSet. |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
119 |
PtrQueue(PtrQueueSet* qset, bool permanent = false, bool active = false); |
28507 | 120 |
|
121 |
// Requires queue flushed or permanent. |
|
122 |
~PtrQueue(); |
|
1374 | 123 |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
124 |
public: |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
125 |
|
1374 | 126 |
// Associate a lock with a ptr queue. |
127 |
void set_lock(Mutex* lock) { _lock = lock; } |
|
128 |
||
46443 | 129 |
// Forcibly set empty. |
130 |
void reset() { |
|
131 |
if (_buf != NULL) { |
|
132 |
_index = capacity_in_bytes(); |
|
133 |
} |
|
134 |
} |
|
1374 | 135 |
|
20403
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20011
diff
changeset
|
136 |
void enqueue(volatile void* ptr) { |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20011
diff
changeset
|
137 |
enqueue((void*)(ptr)); |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20011
diff
changeset
|
138 |
} |
45a89fbcd8f7
8014555: G1: Memory ordering problem with Conc refinement and card marking
mgerdin
parents:
20011
diff
changeset
|
139 |
|
1374 | 140 |
// Enqueues the given "obj". |
141 |
void enqueue(void* ptr) { |
|
142 |
if (!_active) return; |
|
143 |
else enqueue_known_active(ptr); |
|
144 |
} |
|
145 |
||
7920 | 146 |
// This method is called when we're doing the zero index handling |
147 |
// and gives a chance to the queues to do any pre-enqueueing |
|
148 |
// processing they might want to do on the buffer. It should return |
|
149 |
// true if the buffer should be enqueued, or false if enough |
|
150 |
// entries were cleared from it so that it can be re-used. It should |
|
151 |
// not return false if the buffer is still full (otherwise we can |
|
152 |
// get into an infinite loop). |
|
153 |
virtual bool should_enqueue_buffer() { return true; } |
|
4481 | 154 |
void handle_zero_index(); |
37065 | 155 |
void locking_enqueue_completed_buffer(BufferNode* node); |
1374 | 156 |
|
157 |
void enqueue_known_active(void* ptr); |
|
158 |
||
46443 | 159 |
// Return the size of the in-use region. |
160 |
size_t size() const { |
|
161 |
size_t result = 0; |
|
162 |
if (_buf != NULL) { |
|
163 |
assert(_index <= capacity_in_bytes(), "Invariant"); |
|
164 |
result = byte_index_to_index(capacity_in_bytes() - _index); |
|
165 |
} |
|
166 |
return result; |
|
1374 | 167 |
} |
168 |
||
46443 | 169 |
bool is_empty() const { |
170 |
return _buf == NULL || capacity_in_bytes() == _index; |
|
6768
71338ecb7813
6980838: G1: guarantee(false) failed: thread has an unexpected active value in its SATB queue
tonyp
parents:
5547
diff
changeset
|
171 |
} |
71338ecb7813
6980838: G1: guarantee(false) failed: thread has an unexpected active value in its SATB queue
tonyp
parents:
5547
diff
changeset
|
172 |
|
1374 | 173 |
// Set the "active" property of the queue to "b". An enqueue to an |
174 |
// inactive thread is a no-op. Setting a queue to inactive resets its |
|
175 |
// log to the empty state. |
|
176 |
void set_active(bool b) { |
|
177 |
_active = b; |
|
178 |
if (!b && _buf != NULL) { |
|
46443 | 179 |
reset(); |
1374 | 180 |
} else if (b && _buf != NULL) { |
46443 | 181 |
assert(index() == capacity(), |
182 |
"invariant: queues are empty when activated."); |
|
1374 | 183 |
} |
184 |
} |
|
185 |
||
46443 | 186 |
bool is_active() const { return _active; } |
37065 | 187 |
|
1374 | 188 |
// To support compiler. |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
189 |
|
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
190 |
protected: |
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
191 |
template<typename Derived> |
1374 | 192 |
static ByteSize byte_offset_of_index() { |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
193 |
return byte_offset_of(Derived, _index); |
1374 | 194 |
} |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
195 |
|
1374 | 196 |
static ByteSize byte_width_of_index() { return in_ByteSize(sizeof(size_t)); } |
197 |
||
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
198 |
template<typename Derived> |
1374 | 199 |
static ByteSize byte_offset_of_buf() { |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
200 |
return byte_offset_of(Derived, _buf); |
1374 | 201 |
} |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
202 |
|
46443 | 203 |
static ByteSize byte_width_of_buf() { return in_ByteSize(_element_size); } |
1374 | 204 |
|
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
205 |
template<typename Derived> |
1374 | 206 |
static ByteSize byte_offset_of_active() { |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
207 |
return byte_offset_of(Derived, _active); |
1374 | 208 |
} |
34148
6efbc7ffd767
8143014: Access PtrQueue member offsets through derived classes
kbarrett
parents:
33761
diff
changeset
|
209 |
|
1374 | 210 |
static ByteSize byte_width_of_active() { return in_ByteSize(sizeof(bool)); } |
211 |
||
212 |
}; |
|
213 |
||
4481 | 214 |
class BufferNode { |
215 |
size_t _index; |
|
216 |
BufferNode* _next; |
|
36354 | 217 |
void* _buffer[1]; // Pseudo flexible array member. |
218 |
||
219 |
BufferNode() : _index(0), _next(NULL) { } |
|
220 |
~BufferNode() { } |
|
221 |
||
222 |
static size_t buffer_offset() { |
|
223 |
return offset_of(BufferNode, _buffer); |
|
224 |
} |
|
225 |
||
4481 | 226 |
public: |
227 |
BufferNode* next() const { return _next; } |
|
228 |
void set_next(BufferNode* n) { _next = n; } |
|
229 |
size_t index() const { return _index; } |
|
46443 | 230 |
void set_index(size_t i) { _index = i; } |
4481 | 231 |
|
46443 | 232 |
// Allocate a new BufferNode with the "buffer" having size elements. |
233 |
static BufferNode* allocate(size_t size); |
|
4481 | 234 |
|
36354 | 235 |
// Free a BufferNode. |
236 |
static void deallocate(BufferNode* node); |
|
4481 | 237 |
|
37065 | 238 |
// Return the BufferNode containing the buffer, after setting its index. |
239 |
static BufferNode* make_node_from_buffer(void** buffer, size_t index) { |
|
240 |
BufferNode* node = |
|
241 |
reinterpret_cast<BufferNode*>( |
|
242 |
reinterpret_cast<char*>(buffer) - buffer_offset()); |
|
243 |
node->set_index(index); |
|
244 |
return node; |
|
4481 | 245 |
} |
246 |
||
36354 | 247 |
// Return the buffer for node. |
4481 | 248 |
static void** make_buffer_from_node(BufferNode *node) { |
36354 | 249 |
// &_buffer[0] might lead to index out of bounds warnings. |
250 |
return reinterpret_cast<void**>( |
|
251 |
reinterpret_cast<char*>(node) + buffer_offset()); |
|
4481 | 252 |
} |
253 |
}; |
|
254 |
||
1374 | 255 |
// A PtrQueueSet represents resources common to a set of pointer queues. |
256 |
// In particular, the individual queues allocate buffers from this shared |
|
257 |
// set, and return completed buffers to the set. |
|
258 |
// All these variables are are protected by the TLOQ_CBL_mon. XXX ??? |
|
49392
2956d0ece7a9
8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents:
47216
diff
changeset
|
259 |
class PtrQueueSet { |
46443 | 260 |
private: |
261 |
// The size of all buffers in the set. |
|
262 |
size_t _buffer_size; |
|
263 |
||
1374 | 264 |
protected: |
265 |
Monitor* _cbl_mon; // Protects the fields below. |
|
4481 | 266 |
BufferNode* _completed_buffers_head; |
267 |
BufferNode* _completed_buffers_tail; |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
268 |
size_t _n_completed_buffers; |
4481 | 269 |
int _process_completed_threshold; |
1374 | 270 |
volatile bool _process_completed; |
271 |
||
272 |
// This (and the interpretation of the first element as a "next" |
|
273 |
// pointer) are protected by the TLOQ_FL_lock. |
|
274 |
Mutex* _fl_lock; |
|
4481 | 275 |
BufferNode* _buf_free_list; |
1374 | 276 |
size_t _buf_free_list_sz; |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2013
diff
changeset
|
277 |
// Queue set can share a freelist. The _fl_owner variable |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2013
diff
changeset
|
278 |
// specifies the owner. It is set to "this" by default. |
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2013
diff
changeset
|
279 |
PtrQueueSet* _fl_owner; |
1374 | 280 |
|
281 |
bool _all_active; |
|
282 |
||
283 |
// If true, notify_all on _cbl_mon when the threshold is reached. |
|
284 |
bool _notify_when_complete; |
|
285 |
||
286 |
// Maximum number of elements allowed on completed queue: after that, |
|
287 |
// enqueuer does the work itself. Zero indicates no maximum. |
|
288 |
int _max_completed_queue; |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
289 |
size_t _completed_queue_padding; |
1374 | 290 |
|
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
291 |
size_t completed_buffers_list_length(); |
1374 | 292 |
void assert_completed_buffer_list_len_correct_locked(); |
293 |
void assert_completed_buffer_list_len_correct(); |
|
294 |
||
295 |
protected: |
|
296 |
// A mutator thread does the the work of processing a buffer. |
|
297 |
// Returns "true" iff the work is complete (and the buffer may be |
|
298 |
// deallocated). |
|
37065 | 299 |
virtual bool mut_process_buffer(BufferNode* node) { |
1374 | 300 |
ShouldNotReachHere(); |
301 |
return false; |
|
302 |
} |
|
303 |
||
304 |
// Create an empty ptr queue set. |
|
305 |
PtrQueueSet(bool notify_when_complete = false); |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
306 |
~PtrQueueSet(); |
1374 | 307 |
|
308 |
// Because of init-order concerns, we can't pass these as constructor |
|
309 |
// arguments. |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
310 |
void initialize(Monitor* cbl_mon, |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
311 |
Mutex* fl_lock, |
4481 | 312 |
int process_completed_threshold, |
313 |
int max_completed_queue, |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
314 |
PtrQueueSet *fl_owner = NULL); |
1374 | 315 |
|
33761
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
316 |
public: |
329db4b51480
6899049: G1: Clean up code in ptrQueue.[ch]pp and ptrQueue.inline.hpp
kbarrett
parents:
30764
diff
changeset
|
317 |
|
46443 | 318 |
// Return the buffer for a BufferNode of size buffer_size(). |
1374 | 319 |
void** allocate_buffer(); |
320 |
||
46443 | 321 |
// Return an empty buffer to the free list. The node is required |
322 |
// to have been allocated with a size of buffer_size(). |
|
37065 | 323 |
void deallocate_buffer(BufferNode* node); |
1374 | 324 |
|
325 |
// Declares that "buf" is a complete buffer. |
|
37065 | 326 |
void enqueue_complete_buffer(BufferNode* node); |
4481 | 327 |
|
328 |
// To be invoked by the mutator. |
|
37065 | 329 |
bool process_or_enqueue_complete_buffer(BufferNode* node); |
1374 | 330 |
|
331 |
bool completed_buffers_exist_dirty() { |
|
332 |
return _n_completed_buffers > 0; |
|
333 |
} |
|
334 |
||
335 |
bool process_completed_buffers() { return _process_completed; } |
|
4481 | 336 |
void set_process_completed(bool x) { _process_completed = x; } |
1374 | 337 |
|
5082
19e725a3d2eb
6935821: G1: threads created during marking do not active their SATB queues
tonyp
parents:
4481
diff
changeset
|
338 |
bool is_active() { return _all_active; } |
1374 | 339 |
|
340 |
// Set the buffer size. Should be called before any "enqueue" operation |
|
341 |
// can be called. And should only be called once. |
|
342 |
void set_buffer_size(size_t sz); |
|
343 |
||
46443 | 344 |
// Get the buffer size. Must have been set. |
345 |
size_t buffer_size() const { |
|
346 |
assert(_buffer_size > 0, "buffer size not set"); |
|
347 |
return _buffer_size; |
|
348 |
} |
|
1374 | 349 |
|
4481 | 350 |
// Get/Set the number of completed buffers that triggers log processing. |
351 |
void set_process_completed_threshold(int sz) { _process_completed_threshold = sz; } |
|
352 |
int process_completed_threshold() const { return _process_completed_threshold; } |
|
1374 | 353 |
|
354 |
// Must only be called at a safe point. Indicates that the buffer free |
|
355 |
// list size may be reduced, if that is deemed desirable. |
|
356 |
void reduce_free_list(); |
|
357 |
||
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
358 |
size_t completed_buffers_num() { return _n_completed_buffers; } |
2142
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2013
diff
changeset
|
359 |
|
032f4652700c
6720309: G1: don't synchronously update RSet during evacuation pauses
iveresov
parents:
2013
diff
changeset
|
360 |
void merge_bufferlists(PtrQueueSet* src); |
4481 | 361 |
|
362 |
void set_max_completed_queue(int m) { _max_completed_queue = m; } |
|
363 |
int max_completed_queue() { return _max_completed_queue; } |
|
364 |
||
36371
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
365 |
void set_completed_queue_padding(size_t padding) { _completed_queue_padding = padding; } |
fd81a4f0ea00
8139651: ConcurrentG1Refine uses ints for many of its members that should be unsigned types
jprovino
parents:
36354
diff
changeset
|
366 |
size_t completed_queue_padding() { return _completed_queue_padding; } |
4481 | 367 |
|
368 |
// Notify the consumer if the number of buffers crossed the threshold |
|
369 |
void notify_if_necessary(); |
|
1374 | 370 |
}; |
7397 | 371 |
|
30764 | 372 |
#endif // SHARE_VM_GC_G1_PTRQUEUE_HPP |