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