--- old/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp 2019-08-29 14:10:08.686862625 -0400 +++ new/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp 2019-08-29 14:10:08.378846105 -0400 @@ -91,7 +91,7 @@ _notify_when_complete(notify_when_complete), _max_completed_buffers(MaxCompletedBuffersUnlimited), _completed_buffers_padding(0), - _free_ids(new G1FreeIdSet(0, num_par_ids())), + _free_ids(0, num_par_ids()), _processed_buffers_mut(0), _processed_buffers_rs_thread(0) { @@ -100,7 +100,6 @@ G1DirtyCardQueueSet::~G1DirtyCardQueueSet() { abandon_completed_buffers(); - delete _free_ids; } // Determines how many mutator threads can process the buffers in parallel. @@ -287,10 +286,10 @@ } bool G1DirtyCardQueueSet::mut_process_buffer(BufferNode* node) { - uint worker_i = _free_ids->claim_par_id(); // temporarily claim an id + uint worker_id = _free_ids.claim_par_id(); // temporarily claim an id G1RefineCardConcurrentlyClosure cl; - bool result = apply_closure_to_buffer(&cl, node, worker_i); - _free_ids->release_par_id(worker_i); // release the id + bool result = apply_closure_to_buffer(&cl, node, worker_id); + _free_ids.release_par_id(worker_id); // release the id if (result) { assert_fully_consumed(node, buffer_size()); --- old/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp 2019-08-29 14:10:10.194943509 -0400 +++ new/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp 2019-08-29 14:10:09.906928062 -0400 @@ -25,12 +25,12 @@ #ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP #define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP +#include "gc/g1/g1FreeIdSet.hpp" #include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" class G1CardTableEntryClosure; class G1DirtyCardQueueSet; -class G1FreeIdSet; class G1RedirtyCardsQueueSet; class Thread; class Monitor; @@ -118,7 +118,7 @@ size_t _completed_buffers_padding; static const size_t MaxCompletedBuffersUnlimited = SIZE_MAX; - G1FreeIdSet* _free_ids; + G1FreeIdSet _free_ids; // The number of completed buffers processed by mutator and rs thread, // respectively. --- old/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-08-29 14:10:11.735026110 -0400 +++ new/src/hotspot/share/gc/g1/g1FreeIdSet.hpp 2019-08-29 14:10:11.439010233 -0400 @@ -25,7 +25,6 @@ #ifndef SHARE_GC_G1_G1FREEIDSET_HPP #define SHARE_GC_G1_G1FREEIDSET_HPP -#include "memory/allocation.hpp" #include "runtime/semaphore.hpp" #include "utilities/globalDefinitions.hpp" @@ -34,7 +33,7 @@ // 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 { +class G1FreeIdSet { Semaphore _sem; uint* _next; uint _start;