Skip to content

Commit 1668370

Browse files
author
Kim Barrett
committed
8230327: Make G1DirtyCardQueueSet free-id init unconditional
Remove conditional init and make the set an inline member. Reviewed-by: sjohanss, lkorinth, tschatzl
1 parent 79c14f0 commit 1668370

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,8 +1687,7 @@ jint G1CollectedHeap::initialize() {
16871687
// process_cards_threshold and max_cards are updated
16881688
// later, based on the concurrent refinement object.
16891689
G1BarrierSet::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
1690-
&bs->dirty_card_queue_buffer_allocator(),
1691-
true); // init_free_ids
1690+
&bs->dirty_card_queue_buffer_allocator());
16921691

16931692
// Create the hot card cache.
16941693
_hot_card_cache = new G1HotCardCache(this);

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ G1DirtyCardQueueSet::G1DirtyCardQueueSet() :
9090
_process_completed_buffers(false),
9191
_max_cards(MaxCardsUnlimited),
9292
_max_cards_padding(0),
93-
_free_ids(NULL),
93+
_free_ids(0, num_par_ids()),
9494
_processed_buffers_mut(0),
9595
_processed_buffers_rs_thread(0)
9696
{
@@ -99,7 +99,6 @@ G1DirtyCardQueueSet::G1DirtyCardQueueSet() :
9999

100100
G1DirtyCardQueueSet::~G1DirtyCardQueueSet() {
101101
abandon_completed_buffers();
102-
delete _free_ids;
103102
}
104103

105104
// Determines how many mutator threads can process the buffers in parallel.
@@ -108,14 +107,10 @@ uint G1DirtyCardQueueSet::num_par_ids() {
108107
}
109108

110109
void G1DirtyCardQueueSet::initialize(Monitor* cbl_mon,
111-
BufferNode::Allocator* allocator,
112-
bool init_free_ids) {
110+
BufferNode::Allocator* allocator) {
113111
PtrQueueSet::initialize(allocator);
114112
assert(_cbl_mon == NULL, "Init order issue?");
115113
_cbl_mon = cbl_mon;
116-
if (init_free_ids) {
117-
_free_ids = new G1FreeIdSet(0, num_par_ids());
118-
}
119114
}
120115

121116
void G1DirtyCardQueueSet::handle_zero_index_for_thread(Thread* t) {
@@ -286,12 +281,10 @@ bool G1DirtyCardQueueSet::process_or_enqueue_completed_buffer(BufferNode* node)
286281
}
287282

288283
bool G1DirtyCardQueueSet::mut_process_buffer(BufferNode* node) {
289-
guarantee(_free_ids != NULL, "must be");
290-
291-
uint worker_i = _free_ids->claim_par_id(); // temporarily claim an id
284+
uint worker_id = _free_ids.claim_par_id(); // temporarily claim an id
292285
G1RefineCardConcurrentlyClosure cl;
293-
bool result = apply_closure_to_buffer(&cl, node, worker_i);
294-
_free_ids->release_par_id(worker_i); // release the id
286+
bool result = apply_closure_to_buffer(&cl, node, worker_id);
287+
_free_ids.release_par_id(worker_id); // release the id
295288

296289
if (result) {
297290
assert_fully_consumed(node, buffer_size());

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
#ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
2626
#define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
2727

28+
#include "gc/g1/g1FreeIdSet.hpp"
2829
#include "gc/shared/ptrQueue.hpp"
2930
#include "memory/allocation.hpp"
3031

3132
class G1CardTableEntryClosure;
3233
class G1DirtyCardQueueSet;
33-
class G1FreeIdSet;
3434
class G1RedirtyCardsQueueSet;
3535
class Thread;
3636
class Monitor;
@@ -115,7 +115,7 @@ class G1DirtyCardQueueSet: public PtrQueueSet {
115115
size_t _max_cards_padding;
116116
static const size_t MaxCardsUnlimited = SIZE_MAX;
117117

118-
G1FreeIdSet* _free_ids;
118+
G1FreeIdSet _free_ids;
119119

120120
// The number of completed buffers processed by mutator and rs thread,
121121
// respectively.
@@ -126,9 +126,7 @@ class G1DirtyCardQueueSet: public PtrQueueSet {
126126
G1DirtyCardQueueSet();
127127
~G1DirtyCardQueueSet();
128128

129-
void initialize(Monitor* cbl_mon,
130-
BufferNode::Allocator* allocator,
131-
bool init_free_ids = false);
129+
void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator);
132130

133131
// The number of parallel ids that can be claimed to allow collector or
134132
// mutator threads to do card-processing work.

src/hotspot/share/gc/g1/g1FreeIdSet.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#ifndef SHARE_GC_G1_G1FREEIDSET_HPP
2626
#define SHARE_GC_G1_G1FREEIDSET_HPP
2727

28-
#include "memory/allocation.hpp"
2928
#include "runtime/semaphore.hpp"
3029
#include "utilities/globalDefinitions.hpp"
3130

@@ -34,7 +33,7 @@
3433
// contiguous range from 'start' to 'start + size'. Used to obtain a
3534
// distinct worker_id value for a mutator thread that doesn't normally
3635
// have such an id.
37-
class G1FreeIdSet : public CHeapObj<mtGC> {
36+
class G1FreeIdSet {
3837
Semaphore _sem;
3938
uint* _next;
4039
uint _start;

0 commit comments

Comments
 (0)