--- old/src/hotspot/share/gc/g1/dirtyCardQueue.cpp 2019-01-08 20:21:33.360154114 -0500 +++ new/src/hotspot/share/gc/g1/dirtyCardQueue.cpp 2019-01-08 20:21:33.108140820 -0500 @@ -79,6 +79,10 @@ _all_active = true; } +DirtyCardQueueSet::~DirtyCardQueueSet() { + delete _free_ids; +} + // Determines how many mutator threads can process the buffers in parallel. uint DirtyCardQueueSet::num_par_ids() { return (uint)os::initial_active_processor_count(); --- old/src/hotspot/share/gc/g1/dirtyCardQueue.hpp 2019-01-08 20:21:34.216199270 -0500 +++ new/src/hotspot/share/gc/g1/dirtyCardQueue.hpp 2019-01-08 20:21:33.968186187 -0500 @@ -117,6 +117,7 @@ public: DirtyCardQueueSet(bool notify_when_complete = true); + ~DirtyCardQueueSet(); void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator, --- old/src/hotspot/share/gc/g1/g1FreeIdSet.cpp 2019-01-08 20:21:35.120246957 -0500 +++ new/src/hotspot/share/gc/g1/g1FreeIdSet.cpp 2019-01-08 20:21:34.868233664 -0500 @@ -30,8 +30,6 @@ #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" -const uint claimed = UINT_MAX; - G1FreeIdSet::G1FreeIdSet(uint start, uint size) : _sem(size), // counting semaphore for available ids _next(NULL), // array of "next" indices @@ -68,6 +66,8 @@ return index | ((old_head & ~_head_index_mask) + 1 + _head_index_mask); } +const uint Claimed = UINT_MAX; + uint G1FreeIdSet::claim_par_id() { _sem.wait(); // Semaphore gate permits passage by no more than the number of @@ -83,14 +83,14 @@ if (new_head == old_head) break; old_head = new_head; } - DEBUG_ONLY(_next[index] = claimed;) + DEBUG_ONLY(_next[index] = Claimed;) return _start + index; } void G1FreeIdSet::release_par_id(uint id) { uint index = id - _start; assert(index < _size, "invalid id %u", id); - assert(_next[index] == claimed, "precondition"); + assert(_next[index] == Claimed, "precondition"); uintx old_head = Atomic::load(&_head); while (true) { _next[index] = head_index(old_head); --- old/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-01-08 20:21:36.104298865 -0500 +++ new/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-01-08 20:21:35.816283673 -0500 @@ -29,7 +29,11 @@ #include "runtime/semaphore.hpp" #include "utilities/globalDefinitions.hpp" -// Represents a set of free small integer ids. +// Represents a set of small integer ids, from which elements can be +// temporarily allocated for exclusive use. The ids are in a +// contiguous range from 'start' to 'start + size'. Used to obtain a +// distinct worker_id value for a mutator thread that doesn't normally +// have such an id. class G1FreeIdSet : public CHeapObj { Semaphore _sem; uint* _next;