src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
changeset 54663 f03d5a093093
parent 54623 1126f0607c70
child 55539 734e58d8477b
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54662:afce4a27f2c2 54663:f03d5a093093
   329   // free list locks are in the range of values taken by _lockRank
   329   // free list locks are in the range of values taken by _lockRank
   330   // This range currently is [_leaf+2, _leaf+3]
   330   // This range currently is [_leaf+2, _leaf+3]
   331   // Note: this requires that CFLspace c'tors
   331   // Note: this requires that CFLspace c'tors
   332   // are called serially in the order in which the locks are
   332   // are called serially in the order in which the locks are
   333   // are acquired in the program text. This is true today.
   333   // are acquired in the program text. This is true today.
   334   _freelistLock(_lockRank--, "CompactibleFreeListSpace._lock", true,
   334   _freelistLock(_lockRank--, "CompactibleFreeListSpace_lock", true,
   335                 Monitor::_safepoint_check_sometimes),
   335                 Monitor::_safepoint_check_never),
   336   _preconsumptionDirtyCardClosure(NULL),
   336   _preconsumptionDirtyCardClosure(NULL),
   337   _parDictionaryAllocLock(Mutex::leaf - 1,  // == rank(ExpandHeap_lock) - 1
   337   _parDictionaryAllocLock(Mutex::leaf - 1,  // == rank(ExpandHeap_lock) - 1
   338                           "CompactibleFreeListSpace._dict_par_lock", true,
   338                           "CompactibleFreeListSpace_dict_par_lock", true,
   339                           Monitor::_safepoint_check_never)
   339                           Monitor::_safepoint_check_never)
   340 {
   340 {
   341   assert(sizeof(FreeChunk) / BytesPerWord <= MinChunkSize,
   341   assert(sizeof(FreeChunk) / BytesPerWord <= MinChunkSize,
   342          "FreeChunk is larger than expected");
   342          "FreeChunk is larger than expected");
   343   _bt.set_space(this);
   343   _bt.set_space(this);
   364   check_free_list_consistency();
   364   check_free_list_consistency();
   365 
   365 
   366   // Initialize locks for parallel case.
   366   // Initialize locks for parallel case.
   367   for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
   367   for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
   368     _indexedFreeListParLocks[i] = new Mutex(Mutex::leaf - 1, // == ExpandHeap_lock - 1
   368     _indexedFreeListParLocks[i] = new Mutex(Mutex::leaf - 1, // == ExpandHeap_lock - 1
   369                                             "a freelist par lock", true, Mutex::_safepoint_check_sometimes);
   369                                             "a freelist par lock", true, Mutex::_safepoint_check_never);
   370     DEBUG_ONLY(
   370     DEBUG_ONLY(
   371       _indexedFreeList[i].set_protecting_lock(_indexedFreeListParLocks[i]);
   371       _indexedFreeList[i].set_protecting_lock(_indexedFreeListParLocks[i]);
   372     )
   372     )
   373   }
   373   }
   374   _dictionary->set_par_lock(&_parDictionaryAllocLock);
   374   _dictionary->set_par_lock(&_parDictionaryAllocLock);
  2040   assert(chunk->is_free() && ffc->is_free(), "Error");
  2040   assert(chunk->is_free() && ffc->is_free(), "Error");
  2041   _bt.split_block((HeapWord*)chunk, chunk->size(), new_size);
  2041   _bt.split_block((HeapWord*)chunk, chunk->size(), new_size);
  2042   if (rem_sz < SmallForDictionary) {
  2042   if (rem_sz < SmallForDictionary) {
  2043     // The freeList lock is held, but multiple GC task threads might be executing in parallel.
  2043     // The freeList lock is held, but multiple GC task threads might be executing in parallel.
  2044     bool is_par = Thread::current()->is_GC_task_thread();
  2044     bool is_par = Thread::current()->is_GC_task_thread();
  2045     if (is_par) _indexedFreeListParLocks[rem_sz]->lock();
  2045     if (is_par) _indexedFreeListParLocks[rem_sz]->lock_without_safepoint_check();
  2046     returnChunkToFreeList(ffc);
  2046     returnChunkToFreeList(ffc);
  2047     split(size, rem_sz);
  2047     split(size, rem_sz);
  2048     if (is_par) _indexedFreeListParLocks[rem_sz]->unlock();
  2048     if (is_par) _indexedFreeListParLocks[rem_sz]->unlock();
  2049   } else {
  2049   } else {
  2050     returnChunkToDictionary(ffc);
  2050     returnChunkToDictionary(ffc);