Skip to content

Commit 181845a

Browse files
author
Kim Barrett
committedJun 14, 2023
8309899: Rename PtrQueueSet::buffer_size()
Reviewed-by: tschatzl, ayang
1 parent 931625a commit 181845a

12 files changed

+66
-67
lines changed
 

‎src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,9 +39,9 @@ class G1CardTableEntryClosure: public CHeapObj<mtGC> {
3939
virtual void do_card_ptr(CardValue* card_ptr, uint worker_id) = 0;
4040

4141
// Process all the card_ptrs in node.
42-
void apply_to_buffer(BufferNode* node, size_t buffer_size, uint worker_id) {
42+
void apply_to_buffer(BufferNode* node, size_t buffer_capacity, uint worker_id) {
4343
void** buffer = BufferNode::make_buffer_from_node(node);
44-
for (size_t i = node->index(); i < buffer_size; ++i) {
44+
for (size_t i = node->index(); i < buffer_capacity; ++i) {
4545
CardValue* card_ptr = static_cast<CardValue*>(buffer[i]);
4646
do_card_ptr(card_ptr, worker_id);
4747
}

‎src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ uint G1DirtyCardQueueSet::num_par_ids() {
8686
void G1DirtyCardQueueSet::flush_queue(G1DirtyCardQueue& queue) {
8787
if (queue.buffer() != nullptr) {
8888
G1ConcurrentRefineStats* stats = queue.refinement_stats();
89-
stats->inc_dirtied_cards(buffer_size() - queue.index());
89+
stats->inc_dirtied_cards(buffer_capacity() - queue.index());
9090
}
9191
PtrQueueSet::flush_queue(queue);
9292
}
@@ -105,7 +105,7 @@ void G1DirtyCardQueueSet::handle_zero_index(G1DirtyCardQueue& queue) {
105105
BufferNode* old_node = exchange_buffer_with_new(queue);
106106
if (old_node != nullptr) {
107107
G1ConcurrentRefineStats* stats = queue.refinement_stats();
108-
stats->inc_dirtied_cards(buffer_size());
108+
stats->inc_dirtied_cards(buffer_capacity());
109109
handle_completed_buffer(old_node, stats);
110110
}
111111
}
@@ -123,7 +123,7 @@ void G1DirtyCardQueueSet::enqueue_completed_buffer(BufferNode* cbn) {
123123
assert(cbn != nullptr, "precondition");
124124
// Increment _num_cards before adding to queue, so queue removal doesn't
125125
// need to deal with _num_cards possibly going negative.
126-
Atomic::add(&_num_cards, buffer_size() - cbn->index());
126+
Atomic::add(&_num_cards, buffer_capacity() - cbn->index());
127127
// Perform push in CS. The old tail may be popped while the push is
128128
// observing it (attaching it to the new buffer). We need to ensure it
129129
// can't be reused until the push completes, to avoid ABA problems.
@@ -159,7 +159,7 @@ BufferNode* G1DirtyCardQueueSet::get_completed_buffer() {
159159
result = dequeue_completed_buffer();
160160
if (result == nullptr) return nullptr;
161161
}
162-
Atomic::sub(&_num_cards, buffer_size() - result->index());
162+
Atomic::sub(&_num_cards, buffer_capacity() - result->index());
163163
return result;
164164
}
165165

@@ -169,7 +169,7 @@ void G1DirtyCardQueueSet::verify_num_cards() const {
169169
for (BufferNode* cur = _completed.first();
170170
!_completed.is_end(cur);
171171
cur = cur->next()) {
172-
actual += buffer_size() - cur->index();
172+
actual += buffer_capacity() - cur->index();
173173
}
174174
assert(actual == Atomic::load(&_num_cards),
175175
"Num entries in completed buffers should be " SIZE_FORMAT " but are " SIZE_FORMAT,
@@ -285,7 +285,7 @@ void G1DirtyCardQueueSet::record_paused_buffer(BufferNode* node) {
285285
// notification checking after the coming safepoint if it doesn't GC.
286286
// Note that this means the queue's _num_cards differs from the number
287287
// of cards in the queued buffers when there are paused buffers.
288-
Atomic::add(&_num_cards, buffer_size() - node->index());
288+
Atomic::add(&_num_cards, buffer_capacity() - node->index());
289289
_paused.add(node);
290290
}
291291

@@ -341,7 +341,7 @@ BufferNodeList G1DirtyCardQueueSet::take_all_completed_buffers() {
341341
class G1RefineBufferedCards : public StackObj {
342342
BufferNode* const _node;
343343
CardTable::CardValue** const _node_buffer;
344-
const size_t _node_buffer_size;
344+
const size_t _node_buffer_capacity;
345345
const uint _worker_id;
346346
G1ConcurrentRefineStats* _stats;
347347
G1RemSet* const _g1rs;
@@ -351,28 +351,28 @@ class G1RefineBufferedCards : public StackObj {
351351
return p2 - p1;
352352
}
353353

354-
// Sorts the cards from start_index to _node_buffer_size in *decreasing*
354+
// Sorts the cards from start_index to _node_buffer_capacity in *decreasing*
355355
// address order. Tests showed that this order is preferable to not sorting
356356
// or increasing address order.
357357
void sort_cards(size_t start_index) {
358358
QuickSort::sort(&_node_buffer[start_index],
359-
_node_buffer_size - start_index,
359+
_node_buffer_capacity - start_index,
360360
compare_cards,
361361
false);
362362
}
363363

364364
// Returns the index to the first clean card in the buffer.
365365
size_t clean_cards() {
366366
const size_t start = _node->index();
367-
assert(start <= _node_buffer_size, "invariant");
367+
assert(start <= _node_buffer_capacity, "invariant");
368368

369369
// Two-fingered compaction algorithm similar to the filtering mechanism in
370370
// SATBMarkQueue. The main difference is that clean_card_before_refine()
371371
// could change the buffer element in-place.
372372
// We don't check for SuspendibleThreadSet::should_yield(), because
373373
// cleaning and redirtying the cards is fast.
374374
CardTable::CardValue** src = &_node_buffer[start];
375-
CardTable::CardValue** dst = &_node_buffer[_node_buffer_size];
375+
CardTable::CardValue** dst = &_node_buffer[_node_buffer_capacity];
376376
assert(src <= dst, "invariant");
377377
for ( ; src < dst; ++src) {
378378
// Search low to high for a card to keep.
@@ -391,7 +391,7 @@ class G1RefineBufferedCards : public StackObj {
391391
// dst points to the first retained clean card, or the end of the buffer
392392
// if all the cards were discarded.
393393
const size_t first_clean = dst - _node_buffer;
394-
assert(first_clean >= start && first_clean <= _node_buffer_size, "invariant");
394+
assert(first_clean >= start && first_clean <= _node_buffer_capacity, "invariant");
395395
// Discarded cards are considered as refined.
396396
_stats->inc_refined_cards(first_clean - start);
397397
_stats->inc_precleaned_cards(first_clean - start);
@@ -401,7 +401,7 @@ class G1RefineBufferedCards : public StackObj {
401401
bool refine_cleaned_cards(size_t start_index) {
402402
bool result = true;
403403
size_t i = start_index;
404-
for ( ; i < _node_buffer_size; ++i) {
404+
for ( ; i < _node_buffer_capacity; ++i) {
405405
if (SuspendibleThreadSet::should_yield()) {
406406
redirty_unrefined_cards(i);
407407
result = false;
@@ -415,26 +415,26 @@ class G1RefineBufferedCards : public StackObj {
415415
}
416416

417417
void redirty_unrefined_cards(size_t start) {
418-
for ( ; start < _node_buffer_size; ++start) {
418+
for ( ; start < _node_buffer_capacity; ++start) {
419419
*_node_buffer[start] = G1CardTable::dirty_card_val();
420420
}
421421
}
422422

423423
public:
424424
G1RefineBufferedCards(BufferNode* node,
425-
size_t node_buffer_size,
425+
size_t node_buffer_capacity,
426426
uint worker_id,
427427
G1ConcurrentRefineStats* stats) :
428428
_node(node),
429429
_node_buffer(reinterpret_cast<CardTable::CardValue**>(BufferNode::make_buffer_from_node(node))),
430-
_node_buffer_size(node_buffer_size),
430+
_node_buffer_capacity(node_buffer_capacity),
431431
_worker_id(worker_id),
432432
_stats(stats),
433433
_g1rs(G1CollectedHeap::heap()->rem_set()) {}
434434

435435
bool refine() {
436436
size_t first_clean_index = clean_cards();
437-
if (first_clean_index == _node_buffer_size) {
437+
if (first_clean_index == _node_buffer_capacity) {
438438
_node->set_index(first_clean_index);
439439
return true;
440440
}
@@ -457,7 +457,7 @@ bool G1DirtyCardQueueSet::refine_buffer(BufferNode* node,
457457
G1ConcurrentRefineStats* stats) {
458458
Ticks start_time = Ticks::now();
459459
G1RefineBufferedCards buffered_cards(node,
460-
buffer_size(),
460+
buffer_capacity(),
461461
worker_id,
462462
stats);
463463
bool result = buffered_cards.refine();
@@ -468,12 +468,12 @@ bool G1DirtyCardQueueSet::refine_buffer(BufferNode* node,
468468
void G1DirtyCardQueueSet::handle_refined_buffer(BufferNode* node,
469469
bool fully_processed) {
470470
if (fully_processed) {
471-
assert(node->index() == buffer_size(),
471+
assert(node->index() == buffer_capacity(),
472472
"Buffer not fully consumed: index: " SIZE_FORMAT ", size: " SIZE_FORMAT,
473-
node->index(), buffer_size());
473+
node->index(), buffer_capacity());
474474
deallocate_buffer(node);
475475
} else {
476-
assert(node->index() < buffer_size(), "Buffer fully consumed.");
476+
assert(node->index() < buffer_capacity(), "Buffer fully consumed.");
477477
// Buffer incompletely processed because there is a pending safepoint.
478478
// Record partially processed buffer, to be finished later.
479479
record_paused_buffer(node);
@@ -576,7 +576,7 @@ G1ConcurrentRefineStats G1DirtyCardQueueSet::concatenate_log_and_stats(Thread* t
576576
// Flush the buffer if non-empty. Flush before accumulating and
577577
// resetting stats, since flushing may modify the stats.
578578
if ((queue.buffer() != nullptr) &&
579-
(queue.index() != buffer_size())) {
579+
(queue.index() != buffer_capacity())) {
580580
flush_queue(queue);
581581
}
582582

‎src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class G1DirtyCardQueueSet: public PtrQueueSet {
194194

195195
void abandon_completed_buffers();
196196

197-
// Refine the cards in "node" from its index to buffer_size.
197+
// Refine the cards in "node" from its index to buffer_capacity.
198198
// Stops processing if SuspendibleThreadSet::should_yield() is true.
199199
// Returns true if the entire buffer was processed, false if there
200200
// is a pending yield request. The node's index is updated to exclude

‎src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ G1RedirtyCardsLocalQueueSet::~G1RedirtyCardsLocalQueueSet() {
4646
#endif // ASSERT
4747

4848
void G1RedirtyCardsLocalQueueSet::enqueue_completed_buffer(BufferNode* node) {
49-
_buffers._entry_count += buffer_size() - node->index();
49+
_buffers._entry_count += buffer_capacity() - node->index();
5050
node->set_next(_buffers._head);
5151
_buffers._head = node;
5252
if (_buffers._tail == nullptr) {
@@ -130,7 +130,7 @@ void G1RedirtyCardsQueueSet::update_tail(BufferNode* node) {
130130

131131
void G1RedirtyCardsQueueSet::enqueue_completed_buffer(BufferNode* node) {
132132
assert(_collecting, "precondition");
133-
Atomic::add(&_entry_count, buffer_size() - node->index());
133+
Atomic::add(&_entry_count, buffer_capacity() - node->index());
134134
_list.push(*node);
135135
update_tail(node);
136136
}

‎src/hotspot/share/gc/g1/g1RemSet.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,9 @@ class G1MergeHeapRootsTask : public WorkerTask {
12621262

12631263
void apply_closure_to_dirty_card_buffers(G1MergeLogBufferCardsClosure* cl, uint worker_id) {
12641264
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
1265-
size_t buffer_size = dcqs.buffer_size();
1265+
size_t buffer_capacity = dcqs.buffer_capacity();
12661266
while (BufferNode* node = _dirty_card_buffers.pop()) {
1267-
cl->apply_to_buffer(node, buffer_size, worker_id);
1267+
cl->apply_to_buffer(node, buffer_capacity, worker_id);
12681268
dcqs.deallocate_buffer(node);
12691269
}
12701270
}
@@ -1567,7 +1567,7 @@ void G1RemSet::enqueue_for_reprocessing(CardValue* card_ptr) {
15671567
*card_ptr = G1CardTable::dirty_card_val();
15681568
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
15691569
void** buffer = dcqs.allocate_buffer();
1570-
size_t index = dcqs.buffer_size() - 1;
1570+
size_t index = dcqs.buffer_capacity() - 1;
15711571
buffer[index] = card_ptr;
15721572
dcqs.enqueue_completed_buffer(BufferNode::make_node_from_buffer(buffer, index));
15731573
}

‎src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ class G1PostEvacuateCollectionSetCleanupTask2::RedirtyLoggedCardsTask : public G
397397

398398
void do_work(uint worker_id) override {
399399
RedirtyLoggedCardTableEntryClosure cl(G1CollectedHeap::heap(), _evac_failure_regions);
400-
const size_t buffer_size = _rdcqs->buffer_size();
400+
const size_t buffer_capacity = _rdcqs->buffer_capacity();
401401
BufferNode* next = Atomic::load(&_nodes);
402402
while (next != nullptr) {
403403
BufferNode* node = next;
404404
next = Atomic::cmpxchg(&_nodes, node, node->next());
405405
if (next == node) {
406-
cl.apply_to_buffer(node, buffer_size, worker_id);
406+
cl.apply_to_buffer(node, buffer_capacity, worker_id);
407407
next = node->next();
408408
}
409409
}

‎src/hotspot/share/gc/g1/g1YoungGCPreEvacuateTasks.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ static void verify_empty_dirty_card_logs() {
167167
ResourceMark rm;
168168

169169
struct Verifier : public ThreadClosure {
170-
size_t _buffer_size;
171-
Verifier() : _buffer_size(G1BarrierSet::dirty_card_queue_set().buffer_size()) {}
170+
size_t _buffer_capacity;
171+
Verifier() : _buffer_capacity(G1BarrierSet::dirty_card_queue_set().buffer_capacity()) {}
172172
void do_thread(Thread* t) override {
173173
G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(t);
174-
assert((queue.buffer() == nullptr) || (queue.index() == _buffer_size),
174+
assert((queue.buffer() == nullptr) || (queue.index() == _buffer_capacity),
175175
"non-empty dirty card queue for thread %s", t->name());
176176
}
177177
} verifier;

‎src/hotspot/share/gc/shared/ptrQueue.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@
3030

3131
PtrQueue::PtrQueue(PtrQueueSet* qset) :
3232
_index(0),
33-
_capacity_in_bytes(index_to_byte_index(qset->buffer_size())),
33+
_capacity_in_bytes(index_to_byte_index(qset->buffer_capacity())),
3434
_buf(nullptr)
3535
{}
3636

3737
PtrQueue::~PtrQueue() {
3838
assert(_buf == nullptr, "queue must be flushed before delete");
3939
}
4040

41-
BufferNode::AllocatorConfig::AllocatorConfig(size_t size) : _buffer_size(size) {}
41+
BufferNode::AllocatorConfig::AllocatorConfig(size_t size) : _buffer_capacity(size) {}
4242

4343
void* BufferNode::AllocatorConfig::allocate() {
44-
size_t byte_size = _buffer_size * sizeof(void*);
44+
size_t byte_size = _buffer_capacity * sizeof(void*);
4545
return NEW_C_HEAP_ARRAY(char, buffer_offset() + byte_size, mtGC);
4646
}
4747

@@ -50,8 +50,8 @@ void BufferNode::AllocatorConfig::deallocate(void* node) {
5050
FREE_C_HEAP_ARRAY(char, node);
5151
}
5252

53-
BufferNode::Allocator::Allocator(const char* name, size_t buffer_size) :
54-
_config(buffer_size),
53+
BufferNode::Allocator::Allocator(const char* name, size_t buffer_capacity) :
54+
_config(buffer_capacity),
5555
_free_list(name, &_config)
5656
{
5757

@@ -80,7 +80,7 @@ PtrQueueSet::~PtrQueueSet() {}
8080

8181
void PtrQueueSet::reset_queue(PtrQueue& queue) {
8282
if (queue.buffer() != nullptr) {
83-
queue.set_index(buffer_size());
83+
queue.set_index(buffer_capacity());
8484
}
8585
}
8686

@@ -91,7 +91,7 @@ void PtrQueueSet::flush_queue(PtrQueue& queue) {
9191
queue.set_buffer(nullptr);
9292
queue.set_index(0);
9393
BufferNode* node = BufferNode::make_node_from_buffer(buffer, index);
94-
if (index == buffer_size()) {
94+
if (index == buffer_capacity()) {
9595
deallocate_buffer(node);
9696
} else {
9797
enqueue_completed_buffer(node);
@@ -129,7 +129,7 @@ BufferNode* PtrQueueSet::exchange_buffer_with_new(PtrQueue& queue) {
129129

130130
void PtrQueueSet::install_new_buffer(PtrQueue& queue) {
131131
queue.set_buffer(allocate_buffer());
132-
queue.set_index(buffer_size());
132+
queue.set_index(buffer_capacity());
133133
}
134134

135135
void** PtrQueueSet::allocate_buffer() {

‎src/hotspot/share/gc/shared/ptrQueue.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class BufferNode {
165165
// We use BufferNode::AllocatorConfig to set the allocation options for the
166166
// FreeListAllocator.
167167
class BufferNode::AllocatorConfig : public FreeListConfig {
168-
const size_t _buffer_size;
168+
const size_t _buffer_capacity;
169169
public:
170170
explicit AllocatorConfig(size_t size);
171171

@@ -175,7 +175,7 @@ class BufferNode::AllocatorConfig : public FreeListConfig {
175175

176176
void deallocate(void* node) override;
177177

178-
size_t buffer_size() const { return _buffer_size; }
178+
size_t buffer_capacity() const { return _buffer_capacity; }
179179
};
180180

181181
class BufferNode::Allocator {
@@ -187,10 +187,10 @@ class BufferNode::Allocator {
187187
NONCOPYABLE(Allocator);
188188

189189
public:
190-
Allocator(const char* name, size_t buffer_size);
190+
Allocator(const char* name, size_t buffer_capacity);
191191
~Allocator() = default;
192192

193-
size_t buffer_size() const { return _config.buffer_size(); }
193+
size_t buffer_capacity() const { return _config.buffer_capacity(); }
194194
size_t free_count() const;
195195
BufferNode* allocate();
196196
void release(BufferNode* node);
@@ -236,11 +236,11 @@ class PtrQueueSet {
236236
// Return the associated BufferNode allocator.
237237
BufferNode::Allocator* allocator() const { return _allocator; }
238238

239-
// Return the buffer for a BufferNode of size buffer_size().
239+
// Return the buffer for a BufferNode of size buffer_capacity().
240240
void** allocate_buffer();
241241

242242
// Return an empty buffer to the free list. The node is required
243-
// to have been allocated with a size of buffer_size().
243+
// to have been allocated with a size of buffer_capacity().
244244
void deallocate_buffer(BufferNode* node);
245245

246246
// A completed buffer is a buffer the mutator is finished with, and
@@ -249,8 +249,8 @@ class PtrQueueSet {
249249
// Adds node to the completed buffer list.
250250
virtual void enqueue_completed_buffer(BufferNode* node) = 0;
251251

252-
size_t buffer_size() const {
253-
return _allocator->buffer_size();
252+
size_t buffer_capacity() const {
253+
return _allocator->buffer_capacity();
254254
}
255255
};
256256

‎src/hotspot/share/gc/shared/satbMarkQueue.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void SATBMarkQueueSet::set_process_completed_buffers_threshold(size_t value) {
124124

125125
void SATBMarkQueueSet::set_buffer_enqueue_threshold_percentage(uint value) {
126126
// Minimum threshold of 1 ensures enqueuing of completely full buffers.
127-
size_t size = buffer_size();
127+
size_t size = buffer_capacity();
128128
size_t enqueue_qty = (size * value) / 100;
129129
_buffer_enqueue_threshold = MAX2(size - enqueue_qty, (size_t)1);
130130
}
@@ -194,9 +194,9 @@ void SATBMarkQueueSet::set_active_all_threads(bool active, bool expected_active)
194194
virtual void do_thread(Thread* t) {
195195
SATBMarkQueue& queue = _qset->satb_queue_for_thread(t);
196196
if (queue.buffer() != nullptr) {
197-
assert(!_active || queue.index() == _qset->buffer_size(),
197+
assert(!_active || queue.index() == _qset->buffer_capacity(),
198198
"queues should be empty when activated");
199-
queue.set_index(_qset->buffer_size());
199+
queue.set_index(_qset->buffer_capacity());
200200
}
201201
queue.set_active(_active);
202202
}
@@ -209,7 +209,7 @@ bool SATBMarkQueueSet::apply_closure_to_completed_buffer(SATBBufferClosure* cl)
209209
if (nd != nullptr) {
210210
void **buf = BufferNode::make_buffer_from_node(nd);
211211
size_t index = nd->index();
212-
size_t size = buffer_size();
212+
size_t size = buffer_capacity();
213213
assert(index <= size, "invariant");
214214
cl->do_buffer(buf + index, size - index);
215215
deallocate_buffer(nd);
@@ -255,9 +255,9 @@ bool SATBMarkQueueSet::should_enqueue_buffer(SATBMarkQueue& queue) {
255255
// Ensure we'll enqueue completely full buffers.
256256
assert(threshold > 0, "enqueue threshold = 0");
257257
// Ensure we won't enqueue empty buffers.
258-
assert(threshold <= buffer_size(),
258+
assert(threshold <= buffer_capacity(),
259259
"enqueue threshold %zu exceeds capacity %zu",
260-
threshold, buffer_size());
260+
threshold, buffer_capacity());
261261
return queue.index() < threshold;
262262
}
263263

@@ -310,7 +310,7 @@ void SATBMarkQueueSet::print_all(const char* msg) {
310310
while (nd != nullptr) {
311311
void** buf = BufferNode::make_buffer_from_node(nd);
312312
os::snprintf(buffer, SATB_PRINTER_BUFFER_SIZE, "Enqueued: %d", i);
313-
print_satb_buffer(buffer, buf, nd->index(), buffer_size());
313+
print_satb_buffer(buffer, buf, nd->index(), buffer_capacity());
314314
nd = nd->next();
315315
i += 1;
316316
}

‎src/hotspot/share/gc/shared/satbMarkQueue.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ inline void SATBMarkQueueSet::apply_filter(Filter filter_out, SATBMarkQueue& que
181181

182182
// Two-fingered compaction toward the end.
183183
void** src = &buf[queue.index()];
184-
void** dst = &buf[buffer_size()];
184+
void** dst = &buf[buffer_capacity()];
185185
assert(src <= dst, "invariant");
186186
for ( ; src < dst; ++src) {
187187
// Search low to high for an entry to keep.

‎test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -52,9 +52,9 @@ typedef BufferNode::TestSupport::ProcessorThread ProcessorThread;
5252

5353
// Some basic testing of BufferNode::Allocator.
5454
TEST_VM(PtrQueueBufferAllocatorTest, test) {
55-
const size_t buffer_size = 256;
56-
BufferNode::Allocator allocator("Test Buffer Allocator", buffer_size);
57-
ASSERT_EQ(buffer_size, allocator.buffer_size());
55+
const size_t buffer_capacity = 256;
56+
BufferNode::Allocator allocator("Test Buffer Allocator", buffer_capacity);
57+
ASSERT_EQ(buffer_capacity, allocator.buffer_capacity());
5858

5959
// Allocate some new nodes for use in testing.
6060
BufferNode* nodes[10] = {};
@@ -233,10 +233,9 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) {
233233
tty->print_cr("allocator free count: " SIZE_FORMAT, allocator->free_count());
234234
}
235235

236-
const size_t buffer_size = 1024;
237-
238236
TEST_VM(PtrQueueBufferAllocatorTest, stress_free_list_allocator) {
239-
BufferNode::Allocator allocator("Test Allocator", buffer_size);
237+
const size_t buffer_capacity = 1024;
238+
BufferNode::Allocator allocator("Test Allocator", buffer_capacity);
240239
CompletedList completed;
241240
run_test(&allocator, &completed);
242241
}

0 commit comments

Comments
 (0)
Please sign in to comment.