< prev index next >

src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp

Print this page




  40 #include "oops/oop.inline.hpp"
  41 #include "runtime/globals.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/init.hpp"
  44 #include "runtime/java.hpp"
  45 #include "runtime/orderAccess.inline.hpp"
  46 #include "runtime/vmThread.hpp"
  47 #include "utilities/align.hpp"
  48 #include "utilities/copy.hpp"
  49 
  50 /////////////////////////////////////////////////////////////////////////
  51 //// CompactibleFreeListSpace
  52 /////////////////////////////////////////////////////////////////////////
  53 
  54 // highest ranked  free list lock rank
  55 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3;
  56 
  57 // Defaults are 0 so things will break badly if incorrectly initialized.
  58 size_t CompactibleFreeListSpace::IndexSetStart  = 0;
  59 size_t CompactibleFreeListSpace::IndexSetStride = 0;

  60 
  61 size_t MinChunkSize = 0;
  62 
  63 void CompactibleFreeListSpace::set_cms_values() {
  64   // Set CMS global values
  65   assert(MinChunkSize == 0, "already set");
  66 
  67   // MinChunkSize should be a multiple of MinObjAlignment and be large enough
  68   // for chunks to contain a FreeChunk.
  69   size_t min_chunk_size_in_bytes = align_up(sizeof(FreeChunk), MinObjAlignmentInBytes);
  70   MinChunkSize = min_chunk_size_in_bytes / BytesPerWord;
  71 
  72   assert(IndexSetStart == 0 && IndexSetStride == 0, "already set");
  73   IndexSetStart  = MinChunkSize;
  74   IndexSetStride = MinObjAlignment;
  75 }
  76 
  77 // Constructor
  78 CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr) :
  79   _bt(bs, mr),
  80   // free list locks are in the range of values taken by _lockRank
  81   // This range currently is [_leaf+2, _leaf+3]
  82   // Note: this requires that CFLspace c'tors
  83   // are called serially in the order in which the locks are
  84   // are acquired in the program text. This is true today.
  85   _freelistLock(_lockRank--, "CompactibleFreeListSpace._lock", true,
  86                 Monitor::_safepoint_check_sometimes),
  87   _parDictionaryAllocLock(Mutex::leaf - 1,  // == rank(ExpandHeap_lock) - 1
  88                           "CompactibleFreeListSpace._dict_par_lock", true,
  89                           Monitor::_safepoint_check_never),
  90   _rescan_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *




  40 #include "oops/oop.inline.hpp"
  41 #include "runtime/globals.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/init.hpp"
  44 #include "runtime/java.hpp"
  45 #include "runtime/orderAccess.inline.hpp"
  46 #include "runtime/vmThread.hpp"
  47 #include "utilities/align.hpp"
  48 #include "utilities/copy.hpp"
  49 
  50 /////////////////////////////////////////////////////////////////////////
  51 //// CompactibleFreeListSpace
  52 /////////////////////////////////////////////////////////////////////////
  53 
  54 // highest ranked  free list lock rank
  55 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3;
  56 
  57 // Defaults are 0 so things will break badly if incorrectly initialized.
  58 size_t CompactibleFreeListSpace::IndexSetStart  = 0;
  59 size_t CompactibleFreeListSpace::IndexSetStride = 0;
  60 size_t CompactibleFreeListSpace::_min_chunk_size_in_bytes = 0;
  61 
  62 size_t MinChunkSize = 0;
  63 
  64 void CompactibleFreeListSpace::set_cms_values() {
  65   // Set CMS global values
  66   assert(MinChunkSize == 0, "already set");
  67 
  68   // MinChunkSize should be a multiple of MinObjAlignment and be large enough
  69   // for chunks to contain a FreeChunk.
  70   _min_chunk_size_in_bytes = align_up(sizeof(FreeChunk), MinObjAlignmentInBytes);
  71   MinChunkSize = _min_chunk_size_in_bytes / BytesPerWord;
  72 
  73   assert(IndexSetStart == 0 && IndexSetStride == 0, "already set");
  74   IndexSetStart  = MinChunkSize;
  75   IndexSetStride = MinObjAlignment;
  76 }
  77 
  78 // Constructor
  79 CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, MemRegion mr) :
  80   _bt(bs, mr),
  81   // free list locks are in the range of values taken by _lockRank
  82   // This range currently is [_leaf+2, _leaf+3]
  83   // Note: this requires that CFLspace c'tors
  84   // are called serially in the order in which the locks are
  85   // are acquired in the program text. This is true today.
  86   _freelistLock(_lockRank--, "CompactibleFreeListSpace._lock", true,
  87                 Monitor::_safepoint_check_sometimes),
  88   _parDictionaryAllocLock(Mutex::leaf - 1,  // == rank(ExpandHeap_lock) - 1
  89                           "CompactibleFreeListSpace._dict_par_lock", true,
  90                           Monitor::_safepoint_check_never),
  91   _rescan_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *


< prev index next >