src/hotspot/share/utilities/concurrentHashTable.inline.hpp
changeset 53344 cfc839f28b89
parent 53244 9807daeb47c4
child 53555 606b80182f64
equal deleted inserted replaced
53343:07c09e65ca0f 53344:cfc839f28b89
   191     : _log2_size(log2_size), _size(((size_t)1ul) << _log2_size),
   191     : _log2_size(log2_size), _size(((size_t)1ul) << _log2_size),
   192       _hash_mask(~(~((size_t)0) << _log2_size))
   192       _hash_mask(~(~((size_t)0) << _log2_size))
   193 {
   193 {
   194   assert(_log2_size >= SIZE_SMALL_LOG2 && _log2_size <= SIZE_BIG_LOG2,
   194   assert(_log2_size >= SIZE_SMALL_LOG2 && _log2_size <= SIZE_BIG_LOG2,
   195          "Bad size");
   195          "Bad size");
   196   void* memory = NEW_C_HEAP_ARRAY(Bucket, _size, F);
   196   _buckets = NEW_C_HEAP_ARRAY(Bucket, _size, F);
   197   _buckets = new (memory) Bucket[_size];
   197   // Use placement new for each element instead of new[] which could use more
       
   198   // memory than allocated.
       
   199   for (size_t i = 0; i < _size; ++i) {
       
   200     new (_buckets + i) Bucket();
       
   201   }
   198 }
   202 }
   199 
   203 
   200 template <typename VALUE, typename CONFIG, MEMFLAGS F>
   204 template <typename VALUE, typename CONFIG, MEMFLAGS F>
   201 inline ConcurrentHashTable<VALUE, CONFIG, F>::
   205 inline ConcurrentHashTable<VALUE, CONFIG, F>::
   202   InternalTable::~InternalTable()
   206   InternalTable::~InternalTable()